Search code examples
c#visual-studio-2017stylecophungarian-notationresharper-2018

How do I prevent StyleCop warning of a Hungarian notation when prefix is valid


I have the following code:

var fxRate = new FxRate();

which is giving me the following StyleCop ReSharper warning:

The variable name 'fxRate' begins with a prefix that looks like Hungarian notation.

I have tried copying the Settings.StyleCop file to my solution folder and adding an entry for fx:

  <Analyzers>
    <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
      <AnalyzerSettings>
        <CollectionProperty Name="Hungarian">
          ...
          <Value>fx</Value>
          ...

I've restarted VS but I still get the same warning. I am using the StyleCop ReSharper extension in VS2017.

How do I ensure 'fx' is a valid prefix in the solution (for all team members)?


Solution

  • I updated ReSharper to 2018.2.1 and the now the values in the the file:

     <CollectionProperty Name="Hungarian">
              ...
              <Value>fx</Value>
              ...
    

    are getting successfully recognised. This makes the warning go away.

    I'm not sure if it was the update itself or something like a cache being cleared.