如何在page_unload之后调试asp.net错误 - 无法在包含主页和许多用户控件的DropDownList中选择多个项目

问题描述:

vb.net。我们正在构建大量的动态控件,包括下拉列表。在Page_Unload事件完成后立即引发此错误,然后在global.asax Application_Error方法中捕获该错误。如何在page_unload之后调试asp.net错误 - 无法在包含主页和许多用户控件的DropDownList中选择多个项目

“不能在DropDownList中选择多个项目”

堆栈跟踪不告诉我任何关于什么控件实际上是导致此有用。我该如何调试?如果说我是在调试整个页面顺序步骤,我到激发Page_Unload事件的结束,以及错误被立即抛出/捕获在Global.asax:

堆栈是:

Cannot have multiple items selected in a DropDownList. 
Category: at System.Web.UI.WebControls.DropDownList.VerifyMultiSelect() 
    at System.Web.UI.WebControls.ListControl.RenderContents(HtmlTextWriter writer) 
    at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) 
    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 ASP.productsearch_aspx.__RenderpnlGrid(HtmlTextWriter __w, Control parameterContainer) 
    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
    at System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) 
    at System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) 
    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.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
    at System.Web.UI.Control.Render(HtmlTextWriter writer) 
    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.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
    at System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) 
    at System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) 
    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.PageRequestManager.RenderFormCallback(HtmlTextWriter writer, Control containerControl) 
    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
    at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) 
    at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) 
    at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) 
    at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) 
    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) 
    at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) 
    at System.Web.UI.HtmlFormWrapper.System.Web.UI.IHtmlForm.RenderControl(HtmlTextWriter writer) 
    at System.Web.UI.PageRequestManager.RenderPageCallback(HtmlTextWriter writer, Control pageControl) 
    at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) 
    at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) 
    at System.Web.UI.Page.Render(HtmlTextWriter writer) 
    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) 

尝试为System.Web.HttpException设置中断(例外对话框http://msdn.microsoft.com/en-us/library/h22dk1y6.aspx中有一个“查找...”按钮)。应用此设置后,调试程序应在抛出异常时停止(在System.Web.UI.WebControls.DropDownList.VerifyMultiSelect方法中)。在观察窗口中,您应该能够评估this并检查它所指的控件。

+0

谢谢,但这并没有帮助。我确定System.Web.HttpException的异常被捕获,但是如果我在global.asax中有一个断点 - application_Error(),调试器只捕获它。届时,它给我的细节就是我上面粘贴的内容。 – TheRedDwarf

+0

确保在VS中的“调试”选项“只是我的代码”复选框未选中,然后重试。 – lowleveldesign