I keep getting these style "errors" when I compile, and I don't want them. I can't find any reference to stylecop on my hard drive, but everything on the web seems to suggest that these errors result from stylecop. How do I turn them off? They suck.
i.e., "SA1121: Use the built-in type alias 'int' rather than Int32 or System.Int32"
StyleCop requires Resharper to work. Hover over the light bulb for R#, drop down the list of actions that can be done and you should see one for Suppress SA1121. Make that selection and then you will see a dialog for indicating if this rule is error, warning, hint etc. Just turn it off there and you should never see that rule again.
Related
Using Visual Studio 2019 Professional v16.8.2. Whenever code is modified, automatic re-compile is triggered in the background. This has the effect of marking/unmarking error squiggles, adding/removing items from the Error List window, and Intellisense related to these errors.
To demonstrate, ensure Tools > Options > Text Editor > General > Show error squiggles is enabled and view the Error List window. Take any large C++ or C# project which compiles correctly, and deliberately add a closing brace } somewhere in a method. In one small example for me, this generated 251 errors and related error squiggles, though it is possible to generate thousands of errors this way. Now repeatedly delete and then re-add the closing brace...Visual Studio starts to lag as it tries to mark/unmark, and add/remove all these errors.
When typing fast, pasting code, or just using the IDE as a text editor, this is distracting and incredibly annoying.
Is it possible to configure a delay from last keypress before automatic compilation? Ideally I'd like something like ~2000ms, or even the ability to only re-compile manually.
It's working as intended.
It's a function of the Precompiler and Intellisense. Their whole purpose is to catch compiler errors before you try to compile your code which may take a long time (re: your example of "a large project").
There was an update to VS2019 today as of this posting and I just noticed an option under Tools > Options... > Text Editor > Advanced labeled "Auto cancel long running auxiliary operations on typing" with the following radiobox settings:
Automatically adjust maximum allowed typing latency
Maximum allowed typing latency in milliseconds [textbox]
The first option is the one selected by default. You might try changing the setting to force a maximum allowed time to 2000ms (or whatever suits your needs) and see if that helps.
As a side note: I have the exact opposite problem: the squiggles don't go away even on perfectly normal and well-formed code until I save and/or manually compile. (It's a crap shoot on which one actually works first.)
My intellisense almost always goes for "treeChild" when I start typing tr, instead of "true". It's a really small thing, but it's kinda annoying since I will sometimes accidentally press return and it puts treeChild into my bool.
Any ideas why this is or how to get rid of it?
I never even used treeChild. Or looked at it.
In VS 2012, IntelliSense can pre-select the members that you have recently selected in the pop-up List Members box for automatic object name completion, during your current session in the IDE. You can check this: IntelliSense for Most Recently Used Members
To turn off this default behavior, go to Tools-Options-Text Editor-C#-IntelliSense and uncheck the option “Pre-select most recently used member” as below, then click ‘OK’ to save this modification.
I'm trying to get rid of the 'rsOverlappingReportItems'-Warnings in the Visual Studio, since we did the overlapping on purpose.
I did the usual proceeding by getting the warning-code:
SomeRDLC.rdlc : warning rsOverlappingReportItems: The text box
‘textbox236’ and the text box ‘textbox43’ overlap. Overlapping report
items are not supported in all renderers.
In this case, I just expected "rsOverlappingReportItems" to be the Code.
Then I added it on the Project under Build --> Support Warnings.
But this doesn't seem to work this way. As far as I've seen, there is no way to tell the Reporting-Services explictly to ignore this warning, but shouldn't it possible to tell that to the Compiler?
Thanks in advance.
Is there a way to display all of the places where Roslyn has determined that there is a style change to be made (i.e. a light bulb shows up)? I'd like to see them all in a list similar to the errors/warnings tab.
This appears to be different than both build and Intellisense warnings/errors. For instance, if I have an unused "using" statement in my C# file, this qualifies for a quick action (i.e. light bulb), but doesn't show up in the list of warnings and errors.
Just to summarize the answer, you can see all the "light bulbs" (quick action, fix or screwdriver) in the Error List window (in View menu); you need the Messages button to be enabled (next to errors and warnings) and only the items for the documents currently opened are displayed.
You should be able to find them in the Build window (use Build + IntelliSense). You may also want to take a look at JetBrains ReSharper, it has a dedicated window for code issues and picks up a good bit more than the native VS analysis does.
I am having a strange problem with IntelliSense in Visual Studio 2010 C# Express Edition: when it pops up to show me the list of suggestions, the list is missing valid options.
For example, say I want to add a "KeyDown" event handler to a control, I start typing "someControl.K<Ctrl+Space>", but the popup doesn't list the KeyDown event; actually, it does not contain anything starting with a K (not KeyPress or KeyUp either).
This is not so bad, since simply typing "KeyDown" by hand won't kill me, but it is highly irritating, especially when I am dealing with objects whose members I am not familiar with.
After all, one of the uses of IntelliSense is giving you a quick overview of what Methods/Properties/Fields/etc. the object has to offer - but if it leaves out some of them semi-randomly, that point is rather moot.
(By semi-randomly I mean that, while there does not seem to be any discernable pattern for which members are left out, at least it is consistent in that it is apparently always the same ones that are missing.)
Does anyone have any idea what might be causing this phenomenon? A corrupt IntelliSense cache? Is there a way to purge that cache and force a rebuild?
You could try to delete the .sdf and .suo files of your solution (after closing it) and then reopen it.
Also make sure that all Statement Completion options are checked and 'Hide advanced members' is unchecked (see picture).