VSTS Unit Tests Errors, Dev Machine Passes with xUnit.net

0

So we've been dealing with this issue for a while now and can't seem to find out the problem.

As the title states, our dev machines can run the unit tests locally with no issue, however when the unit tests are ran in VSTS, then the Microsoft.WindowsAzure.ServiceRuntime.dll seems to be causing issues.

On top of this, the build agent for VSTS is my dev machine, which in Visual Studio 2015, runs the unit tests without issue...

Any guidance would be extremely helpful!

System.TypeInitializationException : The type initializer for *** threw an exception

---- System.TypeInitializationException : The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.

System.TypeInitializationException : The type initializer for '<Module>' threw an exception.

<CrtImplementationDetails>.ModuleLoadException : The C++ module failed to load while attempting to initialize the default appdomain.

System.Runtime.InteropServices.COMException : Failed to load the runtime. (Exception from HRESULT: 0x80131700)
azure
xunit
azure-pipelines
asked on Stack Overflow Jun 21, 2017 by J_S5280

1 Answer

0

So I'd like to follow up on this, in case someone else finds issues along the same lines in VSTS using xunit.net.

The issue was primarily around Other Console Options in the Visual Studio Test build step. /Platform:x64

enter image description here

The next issue that I encountered after this was corrected was this error System.ArgumentException : Keyword not supported: 'metadata'.

This was a misleading error as the source of the issue was that some unit test projects were referencing other unit test projects for various helper methods and the presence of those other test project dlls in separate test projects, caused duplication of discovery and duplication of those test projects running. After moving these helpers to a Shared test project, removing references to different test projects and ensuring that the Shared test project wouldn't be Discovered when running the tests in VSTS by entering the following in Visual Studio Test Step -> Execution Options ->Test Assembly -:**\xunit.runner.visualstudio.testadapter.dll;-:**\*.Test.Shared.dll;

I hope this helps someone else...

answered on Stack Overflow Jun 30, 2017 by J_S5280

User contributions licensed under CC BY-SA 3.0