2

I'm using FluentValidation 3.4.6, and the target framework of my project is .net 4. I've checked my solution thoroughly to ensure there are no references to older versions of FluentValidation.

I believe this version of FluentValidation has a work-around for a reflection bug introduced in .NET 4.5, however I'm still getting a VerificationException, as described here http://elegantcode.com/2012/08/23/net-4-5-operation-could-destabilize-the-runtime-yikes/

VerificationException is thrown at this point:

MyValidator : AbstractValidator<MyObj>

ctor {
     RuleFor(x => x.SomeProperty).Equal(true);
}

at FluentValidation.Resources.LocalizedStringSource.CreateFromExpression(Expression`1 expression, IResourceAccessorBuilder resourceProviderSelectionStrategy) in c:\projects\FluentValidation\src\FluentValidation\Resources\LocalizedStringSource.cs:line 66
at FluentValidation.Validators.PropertyValidator..ctor(Expression`1 errorMessageResourceSelector) in c:\projects\FluentValidation\src\FluentValidation\Validators\PropertyValidator.cs:line 46
at FluentValidation.Validators.EqualValidator..ctor(Object valueToCompare, IEqualityComparer comparer) in c:\projects\FluentValidation\src\FluentValidation\Validators\EqualValidator.cs:line 37
at FluentValidation.DefaultValidatorExtensions.Equal[T,TProperty](IRuleBuilder`2 ruleBuilder, TProperty toCompare, IEqualityComparer comparer) in c:\projects\FluentValidation\src\FluentValidation\DefaultValidatorExtensions.cs:line 143
at MyValidator..ctor() in MyValidator.cs:line 22
KierenH
  • 169
  • 3
  • 8
  • We also had this "Destabilize the runtime VerificationException" and indeed the FluentValidation 3.4.6 contains a fix for it, so it should work in theory. You should double check that you really reference the correct dlls... – nemesv Oct 13 '12 at 14:02
  • Believe I've done that, packages.config, *.csproj, deleted all FluentValidation.dlls from the top-level solution folder... still no luck – KierenH Oct 13 '12 at 14:58

3 Answers3

2

I set Intellitrace to "IntelliTrace events only" and that prevented this issue for me in VS2010.

phil
  • 21
  • 2
1

I was able to run outside the debugger and eventually narrowed it down to intell-trace. Disable intelli-trace if you hit this issue in 3.4.6.

KierenH
  • 169
  • 3
  • 8
0

I also seemed to get around this by adding FluentValidation* to the list of excluded modules in the intellitrace settings (while keeping both events and call info). This was using version 3.4.6 of FV.NET.

danludwig
  • 46,965
  • 25
  • 159
  • 237