2

I am getting an error when running Code Analysis on a VS2012 solution (C#). I have 43 projects in this solution but 4 are failing with the following error:

CA0001  Error Running Code Analysis
CA0001 : Rule=Microsoft.Security#CA2122, 
Target=Modules.Inspirations.Data.InspirationRepository.#AddImage(Modules.Inspirations.Models.InspirationImage) : 
The following error was encountered while reading module 'Modules.Inspirations': 
Method type parameter in position 0 is not valid.   
[Errors and Warnings]   
(Global)

The only thing I can think of is that there maybe an issue with the method parameter being a complex type (or something askew with the complex type itself). However, there are plenty of other methods that take a complex type as a parameter and the Code Analysis tool has no problems with those.

There seems to be no more detail available then the error message above. I've done a search for this but nothing has come up that fixes this issue.

dazza
  • 181
  • 7
  • 1
    Are you using Microsoft.Bcl.Async? If so: http://stackoverflow.com/questions/17298281/using-microsoft-bcl-async-with-code-analysis-causes-errors – JoanComasFdz Jan 26 '15 at 07:04

2 Answers2

0

Unfortunately, it's not possible to get more information from the Code Analysis run because of the way the exception is handled internally. To dig deeper, you would need to try attaching a debugger to the fxcopcmd.exe process to see why the type signature seems to be unparseable.

Nicole Calinoiu
  • 20,843
  • 2
  • 44
  • 49
0

Sometimes, this error hides the actual error which is actually a warning! This warning is CA0060: "The indirectly-referenced assembly xxxx could not be found. This assembly is not required for analysis, however, analysis results could be incomplete."

In that case, a correction consists in copying the assembly in the output dir (ex: bin\debug). Using the copy local = true property for referenced assembly is one way to do so.

sthiers
  • 3,489
  • 5
  • 34
  • 47