Top "Code-contracts" questions

Code Contracts is a Microsoft open source project which allows you to express pre-conditions, post-conditions, and assertions directly in code.

Building with Code Contracts?

I have the following method: private void DoSomething(CoolClass coolClass) { if (coolClass == null) { throw new ArgumentNullException("coolClass"); } coolClass.Name = "Pepe"; } …

c# code-contracts
Does Visual Studio 2017 work with Code Contracts?

I just installed the newly released Visual Studio 2017 Enterprise (RC). I'm having trouble getting it to work with Code Contracts, …

c# .net visual-studio-2017 code-contracts
Really trying to like CodeContracts in C#

I am finally playing catchup with everything new that has been added in to the .NET 3.5/4.0 Frameworks. The last few …

c# code-contracts
How to properly use Code Contracts in .NET Core

I wonder, how to properly use Code Contracts in .NET Core, so far I tried to add CC to my …

c# .net-core code-contracts
.NET Guard Class Library?

I'm looking for a library or source code that provides guard methods such as checking for null arguments. Obviously this …

.net code-contracts
How come you cannot catch Code Contract exceptions?

System.Diagnostics.Contracts.ContractException is not accessible in my test project. Note this code is purely myself messing around with …

c# visual-studio-2010 .net-4.0 code-contracts
What is a practical usage of Code Contracts in .NET 4.0?

In order to fully understand and take advantage of the new features and enhancements provided with the coming of the …

.net .net-4.0 code-contracts
ReSharper - Possible Null Assignment when using Microsoft.Contracts

Is there any way to indicate to ReSharper that a null reference won't occur because of Design-by-Contract Requires checking? For …

c# resharper code-contracts design-by-contract microsoft-contracts
Debug.Assert vs Code Contract usage

When should I debug.assert over code contracts or vice versa? I want to check precondition for a method and …

c# assert code-contracts
Code Contracts at runtime

As far as I read in a nutshell book, code contracts could degrade the runtime performance. Is it possible to …

c# .net code-contracts production