I'm debugging a class library with the WCF service, which uses installed Azure SDK 2.4 on Windows 8.1 using WCF Test Client and Visual Studio 2013 Ultimate debugger. The library was compiled using AnyCPU. An exception occurs when RoleEnvironment.IsAvailable
is called. Here are the details:
Message=The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.
...
InnerException: System.TypeInitializationException
Message=The type initializer for '<Module>' threw an exception.
Source=Microsoft.WindowsAzure.ServiceRuntime
TypeName=<Module>
StackTrace:
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()
at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()
InnerException: <CrtImplementationDetails>.ModuleLoadException
HResult=-2146233088
Message=The C++ module failed to load while attempting to initialize the default appdomain.
Source=msshrtmi
StackTrace:
at <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, Exception innerException)
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
at .cctor()
InnerException: System.Runtime.InteropServices.COMException
HResult=-2146234334
Message=Invalid operation. (Exception from HRESULT: 0x80131022)
Source=mscorlib
ErrorCode=-2146234334
StackTrace:
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at <CrtImplementationDetails>.GetDefaultDomain()
at <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie)
at <CrtImplementationDetails>.DefaultDomain.Initialize()
at <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* )
at <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* )
Enabling of unmanaged code debugging gave me no new information. I tried to install the last version of Azure SDK, adding useLegacyV2RuntimeActivationPolicy="true"
flag to config file, but none of this helped. The same library code invoked from my test project works without exceptions. Using both x86 and x64 test settings. Debug folders seem to contain the exact same version of ServiceRuntime dll.
What caused this exception, and how I can fix it?