Error when two rules with same check Id exist  
Author Message
ThunderRock





PostPosted: Visual Studio Code Analysis and Code Metrics, Error when two rules with same check Id exist Top

Hi David,

Now I'm facing another problem. I've 2 dlls of custom rules in my VS2005 fxcop and I've kept the checkID for some of the custom rules in the 2 dlls same. But now when I run the code analysis tool with one of the dll selected and the 2nd one not selected, it's giving the error warning as shown below.

CA0001 : Error loading rule 'AvoidFinalize': Item has already been added. Key in dictionary: 'CA5032' Key being added: 'CA5032'

Now the problem is that the above rule is not from the dll which was selected. The above rule "Avoid Finalize" is from the 2nd dll which was not selected when I ran the code analysis tool.

Can you tell me what's going on with my code and the reason for this error

Thanks & Regards,

ThunderRock



Visual Studio Team System15  
 
 
David M. Kean - MSFT





PostPosted: Visual Studio Code Analysis and Code Metrics, Error when two rules with same check Id exist Top

This is by-design, even if the error message is not the best.

Even though the other rules are not selected, we still need to load them. You can't have two rules with the same CheckId.