Open CreepyGnome opened 8 years ago
Hm... Interesting. Could you share full solution? I'll try to reproduce the issue.
Once I have it complete it will be open sourced on github however these issues are making it difficult to get it to s state for public viewing.
Until then, @SergeyTeplyakov how would you like me to share it with the Code Contracts team so it remains private at this time, as I don't want to make available publicly yet?
I was hoping to publish it by today, but unfortunately I have been losing time to several code contract related issues this just being the latest that wasn't already reported.
I am experiencing the same problem and I am using a similar environment. I discovered that this error goes away when I do either one of the following:
or
Requires(identifier != null);
compiles without errors, while Requires<ArgumentNullException>(identifier != null);
fails to compile.I can also reproduce this using the following setup:
As others have noted the problem goes away if I disable runtime contract checking or code analysis. I also see the following error if I enable the static checker but disable code analysis
The "Microsoft.Research.CodeContractsAnalysis" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft\Contracts\Bin\MsBuildCodeContracts.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the
I can provide a project if necessary although I suspect this is more of a configuration issue because this same machine has previously built other projects successfully. I think the key difference was they were targeting the desktop version of the .NET Framework; they were not portable libraries.
When I have "Perform Runtime Contract Checking" enabled to anything other than "None" I get the below errors:
I played with other settings and seems to only be caused by that checkbox being enabled and set to anything other than none.
My Environment
Also I have nothing fancy on the Contracts in the project getting these errors. Nothing more complex than the following examples: