I have a codebase with NUnit test suites, which I run with both Resharper Unit Test Sessions and NCrunch.
One of my test requires FakeItEasy. Out And RefParameters Configuration Extensions. Most of the time it works, but occasionally NCrunch fails that test with error:
System.TypeLoadException : Could not load type 'FakeItEasy.OutAndRefParametersConfigurationExtensions' from assembly 'FakeItEasy, Version=1.21.0.0, Culture=neutral, PublicKeyToken=eff28e2146d5fd2c'.
Re-running the test in NCrunch invariably fixes it immediately.
I don't get that sort of error on any other test
The Resharper Unit Test runner doesn't have any issues with it at all.
I feel like the failures generally seem to happen in association with a git jump, or a Solution Clean, or an NCrunch "Resync"
Any ideas what's wrong and/or what I could do to make these false positives go away?
My best guess here is that the loading of the type from this assembly is sequence specific. Probably if the referenced assembly has been previously loaded into the process, it works fine .. but if the test tries to run and load the assembly itself, it fails.
Turning on the 'pre-load assembly references' NCrunch setting for the test project might make a difference here.
I recommend inspecting the references you have to this assembly in your codebase. Make sure they are a consistent version, and ensure there is a reference from the test project to the assembly (or its equivalent package).