How to use code contracts?

I installed the code from the source site and tried to write some sample code. But R # just writes that Method invocation is skipped. When I look at decompiled sources, I see that this method is conditional: a constant CONTRACTS_FULLmust be defined. I checked everything on the tab Code Contractsin the project settings, but it doesn't seem to work.

How can this be fixed? enter image description here

+4
source share
2 answers

The documentation (pdf) reads:

2 Contracts

, , , , . CONTRACTS_FULL. # ifdef, , , .

Visual Studio 2008 ( 6) msbuild ( A.1), . , ( /p msbuild), . , , , .

, CONTRACTS_FULL.

Perform runtime contract checking Perform static contract checking, Visual Studio , CONTRACTS_FULL , , , , . - , , . ( , CONTRACTS_FULL , .)

, ( Resharper), Contract , . .

+4

" " ( : " " ) ( ) "" .

"CONTRACTS_FULL" " ", .

-1

Source: https://habr.com/ru/post/1625091/


All Articles