Tests fail when run with vstest.console.exe but pass when run from VS2015. Findings: The problematic scenario includes reference to Microsoft.WindowsAzure.ServiceRuntime.dll and usage of the RoleEnvironment class. When the RoleEnvironment class is used in a test project without JustMock and runned from vstest.console the exception will be thrown as well. Here is the exact 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: Invalid operation. (Exception from HRESULT: 0x80131022) Stack Trace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at <CrtImplementationDetails>.GetDefaultDomain() at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* ) at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) --- End of inner exception stack trace --- at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) at .cctor() --- End of inner exception stack trace --- at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() --- End of inner exception stack trace --- at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() Workaround: the vstest.console.exe could be started with parameter /InIsolation, which runs the tests in an isolated process. Here is the link to the command line options: https://msdn.microsoft.com/en-us/library/jj155796.aspx