How to suppress a StyleCop warning?
Here’s what you need: [SuppressMessage(“Microsoft.StyleCop.CSharp.OrderingRules”, “SA1202:ElementsMustBeOrderedByAccess”)]
Here’s what you need: [SuppressMessage(“Microsoft.StyleCop.CSharp.OrderingRules”, “SA1202:ElementsMustBeOrderedByAccess”)]
I solved this issue by going to the project solution (whose build) was giving this error. right click on the project and unload the project. Then right click on the project and edit the .csproj file. Look for these temp (problematic) generated files. (see example code) remove this file references from the .csproj file. Right … Read more
After a lot of digging around and trying various things to no effect, I eventually ended up creating a new minimal solution which reproduced the issue with very little else going on. The issue turned out to be caused by msbuild’s multi-core parallelisation – the ‘m’ parameter. The ‘m’ parameter tells msbuild to spawn “nodes”, … Read more
I don’t really follow this guidance unless I’m in the scenarios you need it: there is an actual ambiguity – mainly this impacts either constructors (this.name = name;) or things like Equals (return this.id == other.id;) you want to pass a reference to the current instance you want to call an extension method on the … Read more
Visual Studio includes FxCop + more. From the developer blog of FxCop: Sorry about my ignorance, but I assume FxCop is completely separate from the Code Analysis in VSTS? More specifically, I assume that if I install the new version of FxCop, VSTS will not take advantage (no shared code?)? If this is the case, … Read more
In your StyleCop install, there’s a Settings.StyleCop file. You can edit this to turn off rules globally. Drag that file onto the Settings Editor executable in that file to edit it. You can also put copies of the settings file into your projects to override the global settings. If you’re using Visual Studio integration and … Read more
Stylecop is a style analysis tool that works at the source code level. It exists primarily to provide a single common style that managed projects can use to remain consistent within the larger world of managed software. It makes decisions regarding style primarily to avoid holy wars (after all, style is almost always an inherently … Read more
There is actually a (subtle) difference between the two. Imagine you have the following code in File1.cs: // File1.cs using System; namespace Outer.Inner { class Foo { static void Bar() { double d = Math.PI; } } } Now imagine that someone adds another file (File2.cs) to the project that looks like this: // File2.cs … Read more