I get the following unhelpful error while building my .NET project when Code Analysis runs. It happens both in Visual Studio and building from the command line with MSBuild.
* 1 total analysis engine exceptions.
MSBUILD : error : CA0001 : The given key was not present in the dictionary.
Any ideas on what is broken?
Edit:
Have found the code that causes it. I have a method in my code.
Public Function Generate(ByVal input As XDocument) As XDocument
' My code
End Function
If I add the following line as the first line of code the error starts happening, if I remove it, the error stops.
Contract.Requires(Of ArgumentNullException)(partCover IsNot Nothing, "input")
It doesn't really make sense as I'm using Code Contracts all through out my project. The only thing different about this method from any other is that it has about 200 lines of XML literals in it. The method transforms the input document to another XML format much like an XSLT. My guess is that it has something to do with that.