Hi, I have a very wierd problem happening to me during unit testing (MSTest in Visual Studio - .NET 3.5 SP1):
- I click "Run All Tests in solution"
- All tests passes, except for one particular class, where every tests throws the following exception: "System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)."
- I then go and set a breakpoint in the class. Result: all tests in the class passes (the same tests that failed before).
- I click "Run All Tests in solution". All tests passes, except for another class.
- I go set a breakpoint in the class. Result: All tests in the class passes
- I click "Run All Tests in solution". All tests passes, except for the first testclass again.
- etc.
As you can see the problem is very inconsistent, making it hard to debug.
I've tried using Fusion Log Viewer, but that gave me confusing results I didn't quite understand.
What should I be looking for? Has anyone else experienced this problem?
Update: Some additional info was requested.
The tests has run fine for months - I think last time I ran them was thursday, and then they ran fine. I've been trying to examine the source control history, to see if something has changed, but nothing out of the ordinary.
I could track back and check out the project at different days back in time, but we're using Visual Source Safe (I know - not my descission :-( ) so I'm hesitating to do that.
The tests are regular unit tests, and I'm using Moq for mock-objects... But as I said - it has worked fine until recently.
I was just hoping for some advice on how to debug this issue.