Open mrudat opened 3 years ago
I think this is just a different manifestation of an issue that's been around for a while: xUnit doesn't isolate static variables well enough between tests.
I'll typically see it where it'll be like:
public readonly static SomeClass Instance = new SomeClass();
And then get an exception -> "Instance was null". How can it possibly be null? lol
Feels like xUnit is trying to compartmentalize and clean up random things for tests, and just doesn't do the static instance stuff properly.. and/or we have our tests misconfigured.
Most of the time the code looks just fine, and the tests just fail due to static variables being toyed with under the hood by the test env. Not sure what to do about that
Since it only bites fairly rarely (for me), it's been low priority to solve. If it happens when im pushing a version, I just rerun the job and it's fine.
I suspect that there's some sort of race around LoquiRegistration; this only happens when unit tests in my branch of Synthesis are run in parallel, putting more overall load on the system. It does not trigger on the very similar test which applies AwesomeNPC and AnotherNPC in the other order, nor does it trigger when the test is run in serial, or under the debugger.
Test Source