Visual Studio 2010 Warning numbers. Where do I find them? - visual-studio-2010

I suppress a few warnings, 1591 is the XML comments warning. It's not that I don't use the comments, there are some false positives.
Now to find the fact that XML comments warning is 1591 took a whole load of googling. Is there a list somewhere? Or a way to display the error number in Visual Studio itself?
Thanks

The Error List hides the error and warning numbers, but if you open the Output panel in Visual Studio (menu : Debug > Windows > Output) and set it to show output from Build, you can find the warning number somewhere in the wall of text.
You could also try building the project from the command line (using msbuild) which will output and highlight all error and warning numbers.

You can find a whole list of them here:
Compiler and Warning messages for C/C++
Compiler and Warning messages for C#

It honestly took me less than 5 seconds of Googling to find that, using the search terms "1591" and "visual studio". The top hit is right on the money: http://www.google.com/search?q=1591+visual+studio
So suffice it to say, this is how I usually find them.
But they're all documented on the page you land at with the above search results: C# Compiler Errors
Do note that the warning numbers are often different for different languages. In particular, C#, VB.NET, and C/C++ all use different compilers and therefore all emit different error codes.
C# Compiler Errors
C/C++ Build Errors
Also, it's worth noting that on VS 2008 and later, you can right-click over a warning in the "Error List" to display documentation related to that warning. This tells you the error level, the error number, and whatever other information you need.

I stumbled on this thread while trying to sort out how to find these in VS2015 with Beckhoff TwinCAT and found the Beckhoff-specific ones under Project->Properties, in the Compiler Warnings tab (as below in 1).
screencap of TwinCAT project properties' compiler warning list

Related

How to suppress "not all code paths return a value" error message in Visual Studio

When I have a method in Visual Studio (2019) that's not returning all code paths, as expected I get the error message that states: "not all code paths return a value".
My blood pressure increases every time the squiggly appears on the method name.
Is it possible to suppress this error so the squigglies go away?
If I screw up and forget, I just want the compiler to whine in the error console after the fact.
I use ReSharper as well, haven't been able to find a setting in there regarding it so far.
My resolution was switching to JetBrains Rider.
Not only does it not annoy you with squiggles, you can configure the IDE to automatically generate the default for the return type (among other options as well).
Side note, I was very surprised at how functional Rider is.
Most importantly, it's significantly faster and more stable than Visual Studio.
Well worth the cost.

Is there a list of Visual Studio warning definitions?

At the moment I'm interested in source code analysis and playing around with the built-in possibilities and other third party plguins.
The biggest problem for me, is to identify or filter for code analysis related warnings in the error list window of Visual Studio.
I think all warnings starting with "CA" are these types of errors. Anyway I'm still not sure and want to get this clarified, so that I have knowledge about this and not just a feeling/believe.
This problem brings me in general to the question: Is there a list of all error/warning "groups" and what they are related to? Is it possible that there are "custom" defined "groups"?
I think this is important since every warning will be pushed to the same window. Based on the task someone is working on, it can be pretty hard to identify relvant warnings/outputs (especially in huge projects).
So far my results or what I think is the meaning (list may be uncomplete):
CA - Source Code Analysis, based on this source
CS - C# compiler in general, based on assumption (I get these while compiling C#)
AD - ?? (I get these from "Roslyn Security Guard" when throwing exceptions while analysing code)
C - C/C++ compiler in general, based on assumption (I know this group of warnings from C/C++ projects)
SG - ?? (Maybe these are warnings coming from successfull analysed code with Roslyn Security Guard (SG = Security Guard?))
Yes SG comes from Roslyn Security Guard. It is a custom name chosen by developer of the analyzer. This is why there is no single list of warnings. Only groups of warnings produced by Microsoft are documented on Msdn. AD001 is shown when an analyzer itself throws an exception because of a bug in it.

Suppress Code Analysis For a Single JS File

My project has a vendor.js file that is showing warnings (TS7027 unreachable code detected).
I don't want to fix those warnings since it's vendors code. But I don't want to see those warnings either.
Is there a way to tell Visual Studio (2017) to suppress all messages for this file (e.g. with the CodeAnalysis.SuppressMessage attribute)?
I am not using resharper, just the built-in code analysis tool.

Can certain compile errors be suppressed in the Error List Dialog?

When compiling a solution with many projects, if I make a compile time error in a project that many other projects use I'll get a flood of errors in the Error List window of visual studio:
Error 80 Metadata file
'C:\trunk\Projects\Libraries\K2DataBaseClient\bin\x64\Debug\CEPCortex.dll'
could not be found C:\trunk\Projects\TradeAiTeacher\CSC
These errors indicate that a project couldn't be built due to another project not being built. These types of errors cascade and don't really tell me anything useful as I know that its all due to a core project failing to build.
These errors often make it harder to find the actual error in the window.
Is there a way to tell visual studio to suppress this type of output and just show me the compile errors in cases like this to make it easy to find what actual code is broken?
Ideally it once the compile error has been fixed we can toggle this hiding off so I see all errors.
I had originally left this version agnostic but visual-studio 2013 is the version I am most concerned with.
No. The C# compiler categorically refuses to consider one error more "important" than another one. It cannot know how important an error can be, it doesn't know enough about the reason it had to produce the error. A missing reference assembly can produce a lot of errors because type definitions are missing. Of course the compiler cannot know the difference between them being undefined because of the missing assembly reference (ignore) or you mistyping a name (don't ignore).
Interpreting the Error List requires a massively parallel computing machine that's capable of high-speed correlation inference and pattern matching. With practical quantum computing still a distant future, you need to use the one that's readily available to any programmer, the one you have between your ears. Start at the top of the list. And work your way down, feeling less inclined to fix them as you progress down the list.
Never hesitate to rebuild before getting to the end of the list when you fixed a gross error. Like a missing assembly reference.
I've found the best way to work with existing the visual studio behavior is to use the advice in this link: and make the compiler stop after the first compile error.
This seems to get as close to solving my problem as you currently can.

Code analysis/FxCop in VS2008

FxCops is something new to me, but as always I would like to get to know the new things..
From what I've read, FxCops is already included in VS2008. I guess it's the "Code Analysis" function. Whenever I try to run it though, it seems to start a rebuild and end in the "Finished Rebuilding" state.
I checked the output window and there are a bunch of warnings there. But if I'm not mistaking, there should be more of a GUI for this then the wall of text in my output window, right?
Am I missing a window that should have popped up? Can I open it somewhere? Or is there anything else I'm missing?
Yes, Code Analysis is the nice friendly name for FxCop. However, I'm not aware of a friendly window beyond the errors / warning list where they should appear, prefixed CA.
On the project properties screen there is a Code analysis tab where you can treat warnings as errors to enforce the rules you care about.
Just so everyone knows, because it took me a long time to figure this out.... Code Analysis / FxCop is only included in Team System and Team Suite versions of VS 2008, not in the Professional Edition.
You're not missing anything - there isn't a pop-up window.
The list of issues in the output window is pretty much all you'd get in FxCop. It's just that FxCop is a standalone application.
Here's a decent article on FxCop and Code Analysis:
Link
An alternative to FxCop would be to use the tool NDepend that lets write Code Rules over C# LINQ Queries (namely CQLinq). NDepend is integrated in VS 2012, 2010 and 2008. Disclaimer: I am one of the developers of the tool
More than 200 code rules are proposed by default. Customizing existing rules or creating your own rules is straightforward thanks to the well-known C# LINQ syntax.
NDepend code rules can be verified live in Visual Studio and at build process time, in a generated HTML+javascript report.
You seems concerned by the number of false-positive. To keep the number of false-positives low, CQLinq offers the unique capabilities to define what is the set JustMyCode through special code queries prefixed with notmycode. More explanations about this feature can be found here. Here are for example two notmycode default queries:
Discard generated and designer Methods from JustMyCode
Discard generated Types from JustMyCode
To keep the number of false-positives low, with CQLinq you can also focus rules result only on code added or code refactored, since a defined baseline in the past. See the following rule, that detect methods too complex added or refactored since the baseline:
warnif count > 0
from m in Methods
where m.CyclomaticComplexity > 20 &&
m.WasAdded() || m.CodeWasChanged()
select new { m, m.CyclomaticComplexity }

Resources