I was learning code contract but it doesn't throw me any error or anything. I am using Visual Studio 2019.
Here's the code:
using System.Diagnostics.Contracts;
namespace ConsoleApp1
{
class Calculations
{
public static void Division(string name)
{
Contract.Requires(!string.IsNullOrEmpty(name));
}
}
class Program
{
static void Main(string[] args)
{
string s = null;
Calculations.Division(s);
}
}
}
How is this not throwing me anything? I pretty much violated the contract when I call Division
.