How to get more details from the exception?

I have a .NET 4.0 web application that implements an error handler in the Application_Error event for Global.asax.

When an exception occurs, it intercepts it and sends me an email that includes a variety of information, such as the registered user, the page on which the error occurred, the contents of the session, etc.

This is all great, but there are some basic missing details that I seem to be unable to find.

For example, this is a subset of the error I would get and the associated stack trace:

Source: Telerik.Web.UI Message: Selection out of range Parameter name: value Stack trace: at Telerik.Web.UI.RadComboBox.PerformDataBinding(IEnumerable dataSource) at Telerik.Web.UI.RadComboBox.OnDataSourceViewSelectCallback(IEnumerable data) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e) at Telerik.Web.UI.RadComboBox.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.RadComboBox.DataBind() at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() at Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 

Now, it’s as fine as I can, knowing that a) the name of the control and b) the value that caused the control to β€œgo out of range”.

Any suggestions on how I can get this information? I ran this in debug mode and the objects passed to Global.asax do not seem to contain any more details that I can see.

+4
source share
3 answers

Ship your PDBs with your builds. This way you get the line numbers and file names of the source code in your exception stack trace. And once you have line numbers, you know what code you wrote on that line.

+2
source

I could not fulfill my requirement without executing any custom code.

Now I added the code to MasterPage, which stores the __EVENTTARGET and __EVENTARGUMENT parameters for each postback. They are cleared whenever a new page load appears. If an error occurs, these values ​​form part of the debugging email, which allows us to understand what the user does when an error occurs.

0
source

You can show such an exception as follows

 try { } catch(Exception ex) { Response.Write("Source: " + ex.Source); Response.Write("Message: " + ex.Message); Response.Write("Stack Trace: " + ex.StackTrace); } 
-1
source

Source: https://habr.com/ru/post/1402281/


All Articles