I get an exception when I use code contracts with the following code:
public void Debug(
dynamic message1,
dynamic message2 = null,
dynamic message3 = null,
dynamic message4 = null,
dynamic message5 = null,
dynamic message6 = null)
{
Contract.Requires(message1 != null,
"First Logged Message cannot be null");
}
I am trying to adjust project settings so that checks are performed at runtime.
The exception is "Cannot dynamically call the method" Required "because it has a conditional attribute." I re-read the Code Contracts documentation a couple of times and performed some searches, but I donβt understand where the conditional attribute comes from.
source
share