'Dotnet Unit tests failed once but works on the second run

I'm facing a problem when I want to run unit test on my c# project. I have the same behaviour using Visual Studio or command line. Here's my process:

  1. Ensure that project is clean (bin and obj folders are not present)
  2. Build myproject.sln
  3. Run test

1st run : I have failure because path in App.config file is null

  1. Run again (without clean, rebuild or something else) 2nd run : all tests passed

I took a look at this topic : Unit test works only on second run but doesn't work for me because I already have the last version of NUnit framework.

I quite beginner on Dotnet so I think I missed some informations.


EDIT :

This topic app.config not beeing loaded in .Net Core MSTests project solved my problem. It seems that compatibility isn't as obvious as I thought.

Anyway, can someone explains why this problem seems to solve itself when launching 2 run in a row?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source