9
votes

We are using Resharper 4.5 and StyleCop 4.3.

We have a project with many .CS files in it. All .CS files have valid headers, as defined by our StyleCop settings, and added automatically by Resharper's Insert/replace header action.

Four of the .CS files receive a SA1636 warning. The copyright text exactly matches the declared copyright text from the settings file.

Has anyone else experienced this problem? Is there any kind of diagnostic logging that we can enable or otherwise use to help determine why this one rule appears to be mis-firing?

2
Does deleting the header and auto-inserting it again produce the same error? There could be hidden characters within the text, such as tabs or unicode, that you just aren't seeing.Will Eddins
There was a hidden unicode character inserted by the StyleCop editor in front of the copyright symbol. Thanks!David North

2 Answers

6
votes

Check the encoding format using something like notepad or visual studio Save As - mine was encoding with the wrong character set.

1
votes

In case @Adrian's answer didn't work for you, this one will:

  1. Right click over StyleCop.json
  2. Click on Properties
  3. Change the build action to 'C# analyser additional file':

Choose C# analyzer additional file instead of None

Credits to Peter Morlion: https://blog.submain.com/stylecop-detailed-guide/