When running any unit test under a code coverage tool (e.g. TestDriven.NET "Test With" NCover or VS Coverage) which contains a call to either of the ValidationResult constructors, I get a System.Security.VerificationException like
Test 'xxx' failed: System.Security.VerificationException : Operation could destabilize the runtime. at FluentValidation.Results.ValidationResult..ctor()
Based on this SO answer: http://stackoverflow.com/a/2883384/236255, it looks like removing the AllowPartiallyTrustedCallers assembly attribute might be the fix in http://fluentvalidation.codeplex.com/SourceControl/changeset/view/58a381d61018#src%2fCommonAssemblyInfo.cs
Thanks.
Comments: I get a similar issue when running under Debug. Without Debug on a simple NotEmpty() rule my tests work. As soon as I debug the test then the ForRule throws a System.Security.VerificationException with the following stacktrace: at FluentValidation.Resources.LocalizedStringSource.CreateFromExpression(Expression`1 expression, IResourceAccessorBuilder resourceProviderSelectionStrategy) at FluentValidation.Validators.PropertyValidator..ctor(Expression`1 errorMessageResourceSelector) at FluentValidation.Validators.NotEmptyValidator..ctor(Object defaultValueForType) at FluentValidation.DefaultValidatorExtensions.NotEmpty[T,TProperty](IRuleBuilder`2 ruleBuilder) at EST.MW.Common.Validation.ContactUsValidator..ctor()
Test 'xxx' failed: System.Security.VerificationException : Operation could destabilize the runtime. at FluentValidation.Results.ValidationResult..ctor()
Based on this SO answer: http://stackoverflow.com/a/2883384/236255, it looks like removing the AllowPartiallyTrustedCallers assembly attribute might be the fix in http://fluentvalidation.codeplex.com/SourceControl/changeset/view/58a381d61018#src%2fCommonAssemblyInfo.cs
Thanks.
Comments: I get a similar issue when running under Debug. Without Debug on a simple NotEmpty() rule my tests work. As soon as I debug the test then the ForRule throws a System.Security.VerificationException with the following stacktrace: at FluentValidation.Resources.LocalizedStringSource.CreateFromExpression(Expression`1 expression, IResourceAccessorBuilder resourceProviderSelectionStrategy) at FluentValidation.Validators.PropertyValidator..ctor(Expression`1 errorMessageResourceSelector) at FluentValidation.Validators.NotEmptyValidator..ctor(Object defaultValueForType) at FluentValidation.DefaultValidatorExtensions.NotEmpty[T,TProperty](IRuleBuilder`2 ruleBuilder) at EST.MW.Common.Validation.ContactUsValidator..ctor()