This project is read-only.

Code contracts

May 20, 2011 at 8:17 AM

I recently updated to the latest version as a bug was fixed which occured in my application, however I now get the following error (as an assert in a popup):

"Description: This assembly must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.Requires<TException> and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from https://go.microsoft.com/fwlink/?LinkID=169180. After the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that "Perform Runtime Contract Checking" is enabled, which will define CONTRACTS_FULL. Stack Trace: at ImageTools.ImageBase.SetPixels(Int32 width, Int32 height, Byte[] pixels) ...." etc.

Why did you use the code contracts extension? I think to solve this error, I should install and configure CCRewrite also for my project, but I prefer not to do that. Does anyone else get this error also or does anyone have a solution how to fix this?

Thanks.

Coordinator
May 20, 2011 at 9:32 AM
You only need code contracts if you wanna build imagetools, not for your projects.
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
May 24, 2011 at 12:03 PM

Thanks for your quick reply. I tried using a compiled version, 0.3. In this case I don't get the assert. However a recent fix, I would like to use is not included in version 0.3. When I get the latest version and build it myself, I get the assert as mentioned above (I installed the code contracts installer).

Are you planning to build a new release soon? In that case I will wait for that one.

Jul 19, 2011 at 10:38 PM

I did this too because current release has errors when using gif in a silverlight app so how do we fix this?

Sep 6, 2011 at 3:57 PM

Any updates on this? When do you expect to create a new release?

Thanks.

Jun 6, 2012 at 7:22 PM

If you perform a search and replace you can bypass the use of code contracts.

Search for "Contracts." and replace it with "//Contracts."

This will comment out the code contract assertions.  Worked for me at least.

Apr 3, 2014 at 11:02 AM
The same issue here. Last release is very old, had to rebuild it. Now when my app launches I get ""Description: This assembly must be rewritten using the code contracts binary ..." error.
Contracts makes this library totally unusable!
Have to replace "Contract." with "//Contract." also.