MS Test error while running all tests

I am currently working on a project using MS Test for unit testing. When I execute “Run All Tests”, I get the following error for about 1/3 of the tests:

Test Method [Test Method] threw a System.IO.FileLoadException exception, but a System.InvalidOperationException was expected. Exception message: System.IO.FileLoadException: loading this assembly will result in another set of grants from other instances. (Exception from HRESULT: 0x80131401)

If I go to any of the failed tests and run the test on my own, it will give the same error. If I set a breakpoint in the test and debug the test, it will fail without errors. If I run the individual test again, it will pass. If I go back to running all the tests, I will again get the above error for 1/3 of the tests.

I had this problem before, and I did nothing to fix it, and it just magically went away. But now he is back and very upset.

What causes this error? Is there a fix for this error?

+3
source share
1 answer

It looks like you are Interactive Tests - xUnit Test Patterns smell.

, , , , , , .

, , . MSTest, , , , .

, , . .

  • ( Visual Basic)

FileLoadException , , . , , , .

+1

Source: https://habr.com/ru/post/1728629/


All Articles