本文介绍了System.InvalidOperationException:堆栈为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行Visual Studio 2013中内置的ASP.NET 4.x应用程序后,出现以下异常.
Once running ASP.NET 4.x application built in Visual Studio 2013 I am getting the below exception.
我试图通过删除页面检查器程序集来禁用PageInspector
I have tried to disable the PageInspector by removing page inspector assembly
<assemblies>
<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</assemblies>
并将此配置添加到应用设置
and adding this configuration to app settings
<appSettings>
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/>
</appSettings>
没有任何帮助.
[/Pages/TargetPage.aspx] System.Web.HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> 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.<CallHandlersPossiblyUnderLock>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)
有什么办法可以避免该异常吗?非常感谢您的任何建议
Is there any way how to avoid the exception?Thanks a lot for any suggestions
推荐答案
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)
...
按照建议添加后:
<appSettings>
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/>
...
</appSettings>
我注意到我在下拉列表中有重复的所选项目,从而造成了问题.
I noticed I had duplicate selected item on a dropdown list creating the issue.
这篇关于System.InvalidOperationException:堆栈为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!