I just upgraded a project from 2008 to 2010 Beta 2 and StyleCop is now reporting SA1305 (Hungarian notation) warnings on variable names with the prefix 'is'. 'Is' is definitely in the list of allowed prefixes.
Is this a known issue? Has anyone else run across this problem? The code was definitely compiling without any warnings in 2008.
Update: It turns out that this can work as expected in Visual Studio, but then fail through MSBuild. See the answer below for why.
You can manually add the "is" exception to Settings.StyleCop:
<Analyzers>
<Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
<AnalyzerSettings>
<CollectionProperty Name="Hungarian">
<Value>is</Value>
</CollectionProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
I ran across a similar issue now when building with msbuild vs on a developer box. It turns out that the default Settings.StyleCop (C:\Program Files (x86)\MSBuild\Microsoft\StyleCop\v4.4
) that is installed actually contains a bunch of values you will need to duplicate in your own file if either:
or
Specifically - the StyleCop Settings Editor picks up the Hungarian notation excludes from the other file automatically, regardless of what the "Settings Files" tab says.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With