title: System.InvalidOperationException: Stack empty
body: <p>Once running ASP.NET 4.x application built in Visual Studio 2013 I am getting the below exception.</p>
  
  <p>I have tried to disable the PageInspector by removing page inspector assembly</p>
  
  <pre><code>&lt;assemblies&gt;
      &lt;remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
  &lt;/assemblies&gt;
  </code></pre>
  
  <p>and adding this configuration to app settings</p>
  
  <pre><code>&lt;appSettings&gt;
      &lt;add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>Nothing helped. </p>
  
  <pre><code>[/Pages/TargetPage.aspx] System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---&gt; System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---&gt; System.InvalidOperationException: Stack empty.
     at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
     at System.Collections.Generic.Stack`1.Pop()
     at Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject)
     at System.Web.UI.RenderTraceListener.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject)
     at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
     at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
     at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     at System.Web.UI.Page.HandleError(Exception e)
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     at System.Web.UI.Page.LegacyPageAsyncInfo.&lt;CallHandlersPossiblyUnderLock&gt;b__32(Object o)
     at System.Web.HttpContext.InvokeCancellableCallback(WaitCallback callback, Object state)
     at System.Web.UI.Page.LegacyPageAsyncInfo.CallHandlersPossiblyUnderLock(Boolean onPageThread)
     at System.Web.UI.Page.LegacyPageAsyncInfo.CallHandlers(Boolean onPageThread)
     at System.Web.HttpAsyncResult.End()
     at System.Web.UI.Page.LegacyAsyncPageEndProcessRequest(IAsyncResult result)
     at System.Web.UI.Page.AsyncPageEndProcessRequest(IAsyncResult result)
  </code></pre>
  
  <p>Is there any way how to avoid the exception? 
  Thanks a lot for any suggestions</p>