System.InvalidOperationException: Stack empty

前端 未结 11 1923
情深已故
情深已故 2020-12-09 03:09

Once running ASP.NET 4.x application built in Visual Studio 2013 I am getting the below exception.

I have tried to disable the PageInspector by removing page inspect

相关标签:
11条回答
  • 2020-12-09 03:22

    There are multiple reasons why the

    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. -
    System.InvalidOperationException: Stack empty.
    Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject)
    ...
    

    After adding as proposed:

     <appSettings>
       <add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/>
       ...
     </appSettings>
    

    I noticed I had duplicate selected item on a dropdown list creating the issue.

    0 讨论(0)
  • 2020-12-09 03:24

    In my case (ASP.NET 4.6, Visual Studio 2015) I commented an asp text control and added a new asp drop down list but did not updated the AssociatedControlID of the associated label.

    on changing the AssociatedControlID to newly added asp drop down list ID my problem was fixed.

    0 讨论(0)
  • 2020-12-09 03:26

    I had the same exception, but in my case the problem was the following was missing:

    <form runat="server">
    </form>
    
    0 讨论(0)
  • 2020-12-09 03:27

    I disabled browser link in VS 2013 and was able to see the actual cause of the error. It is usually something underlying when browser link is set. You can see how to disable it here: http://www.poconosystems.com/software-development/how-to-disable-browser-link-in-visual-studio-2013/

    0 讨论(0)
  • 2020-12-09 03:31

    In my case, because I had so many issues migrating a website from VS2002 to VS2015, I decided to create a new project on VS2015 and transfer all webforms from the old project (VS2002) to the new one (VS2015).

    The new project had a Site.Master page, which already has a tag. Because I was transferring old webforms without modification, they already had a tag too, so each page trying to load had two tags inside.

    When I removed the tag on each page, leaving only the one on Site.Master page, the problem was solved.

    I hope this helps.

    0 讨论(0)
  • 2020-12-09 03:35

    This can happen if the AssociatedControlID on a label is associated with a control which can't be found.

    0 讨论(0)
提交回复
热议问题