Search code examples
azurevisual-studio-2013visual-studio-debugging

Can't debug azure solution after upgrading to sdk 2.2. Solution runs fine without debugging. Can attach debugger to running emulator


I have a cloud solution with 2 roles: 1 web role, 1 worker role. The solution has recently been upgraded from sdk 2.1 where it worked fine.

If I run the solution without debugging e.g Ctrl-F5 the emulator fires up and the roles function as required. I can even attach a debugger to the running roles, though I have missed all role initialization by that point.

If I run with debugging e.g F5, the emulator starts up; the worker role gets stuck at "Role state busy", the web role gets stuck at "Role unhealthy" and visual studio becomes unresponsive and needs Task manager to kill. In VS the deploy animation in the lower RHS keeps running. Even if I comment out all the OnStart and Run overrides of the RoleEntryPoint s the same happens. I cannot hit any breakpoints no matter how early in app lifecycle so I am pretty sure it is an emulator infrastructure/ vs debugger issue.

I am currently running with assembly bind logging on and haven't noticed anything out of the ordinary. I have checked and rechecked that the sdk references in all projects and all dependencies have been upgraded.

If I run with debugging and with Role diagnostics enabled I get entries related to configuration updates added to the output even when everything else is frozen. e.g:

    [Diagnostics]: Checking for configuration updates 10/01/2014 

I am looking for new lines of investigation, having exhausted everything I can think of. Incidentally this is not machine specific, I have tested on several machines and they all exhibit this behavior.

EDIT: I should note that other cloud solutions are debuggable even with the 2.2 sdk.

UPDATE: I am getting the following in the logs:

<Log>
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
        <Provider Name="Application Hang"/>
        <EventID Qualifiers="0">1002</EventID>
        <Level>2</Level>
        <Task>101</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2014-01-17T18:53:34.000000000Z"/>
        <EventRecordID>1216077</EventRecordID>
        <Channel>Application</Channel>
        <Computer>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Computer>
        <Security/>
    </System>
    <EventData>
        <Data>devenv.exe</Data>
        <Data>12.0.21005.1</Data>
        <Data>2910</Data>
        <Data>01cf13b4114dc59b</Data>
        <Data>4294967295</Data>
        <Data>C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe</Data>
        <Data>a94194c4-7fa8-11e3-bed7-001e4fea6057</Data>
        <Data/>
        <Data/>
        <Binary>54006F00700020006C006500760065006C002000770069006E0064006F0077002000690073002000690064006C00650000000000</Binary>
    </EventData>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
    <Provider Name="ASP.NET 4.0.30319.0"/>
    <EventID Qualifiers="49152">1325</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-01-17T18:56:06.000000000Z"/>
    <EventRecordID>1216080</EventRecordID>
    <Channel>Application</Channel>
    <Computer>xxxxxxxxxxxxxxxxxxxxxxxxxxx</Computer>
    <Security/>
</System>
<EventData>
    <Data>Failed to initialize the AppDomain:/LM/W3SVC/6/ROOTException: System.SystemExceptionMessage: Failed to create AppDomain.StackTrace:    at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)InnerException: System.Runtime.InteropServices.COMExceptionMessage: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))StackTrace:    at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone&amp; zone, StringHandleOnStack retUrl)   at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()   at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)   at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)   at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)   at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)   at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)   at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)   at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)   at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)   at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)   at System.Security.Policy.Evidence.GetHostEvidence[T]()   at System.Web.Hosting.ApplicationManager.GetDefaultDomainIdentity()   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)</Data>
</EventData>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
    <Provider Name="ASP.NET 4.0.30319.0"/>
    <EventID Qualifiers="49152">1325</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-01-17T18:56:06.000000000Z"/>
    <EventRecordID>1216080</EventRecordID>
    <Channel>Application</Channel>
    <Computer>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Computer>
    <Security/>
</System>
<EventData>
    <Data>Failed to initialize the AppDomain:/LM/W3SVC/6/ROOTException: System.SystemExceptionMessage: Failed to create AppDomain.StackTrace:    at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)InnerException: System.Runtime.InteropServices.COMExceptionMessage: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))StackTrace:    at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone&amp; zone, StringHandleOnStack retUrl)   at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()   at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)   at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)   at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)   at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)   at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)   at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)   at System.Security.Policy.Evidence.GenerateHostEvidence(Type type, Boolean hostCanGenerate)   at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)   at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)   at System.Security.Policy.Evidence.GetHostEvidence[T]()   at System.Web.Hosting.ApplicationManager.GetDefaultDomainIdentity()   at System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)</Data>
</EventData>
</Event>
</Log>

Solution

  • Updating to VS 2013 Update 2RC and installing the Azure 2.3 SDK has fixed the issue. (I have not upgraded the project to 2.3 yet)