Archive for 04:30 PM

Using gendarme with Code Contracts from .NET 4.0

04:30 PM

When using gendarme on post-processed assemblies with code contracts and /throwonfailure set, a few things have to be ignored. Put the following lines into your ignore file (for example gendarmeignore.txt) and use it with --ignore on the command line.


R: Gendarme.Rules.Exceptions.ExceptionShouldBeVisibleRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

R: Gendarme.Rules.Exceptions.MissingExceptionConstructorsRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

R: Gendarme.Rules.Serialization.MissingSerializableAttributeOnISerializableTypeRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

R: Gendarme.Rules.Serialization.MissingSerializationConstructorRule
T: System.Diagnostics.Contracts.__ContractsRuntime/ContractException

Since this is a tool-generated class we cannot do anything about it anyways and should not access or need the missing features.