The CreateInstanceAndUnwrap call below is failing somewhat randomly in our...
The CreateInstanceAndUnwrap call below is failing somewhat randomly in our test runs with an error claiming it can't load Roslyn.Test.Utilities. So far we've been unable to actually catch this failure under a debugger because as previously stated the failure is random. The only interesting data we have is that it's much more likely to fail in xUnit2 parallel mode than xUnit1. Looking at the code there seems to be an obvious explanation. The Environment.CurrentDirectory value becomes the resolver path for the newly created AppDomain instance. If this value doesn't point to the test binaries directory then it would explain the failure. This is a process wide value that can easily be changed by other code. Even if the code is careful to reset the value afterwards the intermediate value would be visible across AppDomains and cause this problem. A more stable value is AppDomain.CurrentDomain.BaseDirectory. This value is AppDomain specific, immutable, and was already sufficient to load this particular assembly. (changeset 1409768)
Showing
想要评论请 注册 或 登录