Jun 3, 2010 at 4:17 PM
Edited Jun 3, 2010 at 4:19 PM
Given that this is a generic error code indicating a fault in the StyleCop engine, shouldn't it include sufficient information for the StyleCop team to be able to diagnose what actually went wrong? Whilst I love StyleCop, I have been plagued by this issue for a long time and am near giving up on it. My project is too large and complex to be able to easily produce a repro, but if you would just include a stack trace or something in the error message then I wouldn't really have to - I could just pass it onto you guys. Hell, encrypt the stack trace with a key known only to the StyleCop team if you like so that only you guys can read it. I don't care - I just want these issues fixed.

To my current problem, I randomly get this:

SA0001: An exception occurred while parsing the file: System.ArgumentException, An item with the same key has already been added.

I say randomly because sometimes my project builds fine, but often I get the above. The only other hint I get is the name of a file, but it's a very simple interface definition so I'm not convinced it's the problem. Once again I'll have to waste hours trying to pinpoint exactly what is causing this.

Please, please, please, do something about SA0001. Please.

Jun 3, 2010 at 10:01 PM

Actually we do dump the stack trace as of version 4.4. Also, now that the StyleCop code has been open sourced, it's possible for you to grab the source and build a debug version, which would allow us to debug the issue much more effectively.


Jun 4, 2010 at 8:27 AM
Awesome - thanks Jason. I'll give it a bash ASAP.
Jun 19, 2010 at 9:15 PM

Don't you use third-party custom rules?
They could greatly increase your chances for getting unexpected SA0001.

Best regards,
Oleg Shuruev 

Jun 20, 2010 at 9:15 AM

@shuruev: no, I don't. Turns out that 4.4 seems to have fixed this issue - for my particular instance, at least.