c# - Exception error message with incorrect line number -


When an exception is thrown in a Asp.Net Web page, is displayed with an error message that the entire stack trace is.

Below is an example:

Stack trace:
IndexOutRangeException: was out of range of the index array

MyNameSpace .SPAPP.ViewDetailsCodeBehind.LoadView () 5112 MyNameSpace.SPAPP.ViewDetailsCodeBehind.Page_Load (object sender, EventArgs e) 67
System.Web. Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback (object sender, EventArgs e) +43
System.Web. UI.Control.OnLoad (EventArgs e) +98
... ...

The problem is that the line numbers shown do not correspond to the line in my code is That exception has arisen. In the example above
, the stack shows line number 5111, yet my code file behind .cs is only 250 lines!

The aspx page is stored in a SharePoint site and the assembly with the code behind it has been deployed in GAC. In addition, I've compiled in debug mode.

Looking at the settings above, how can I find out which row is the reason for my code?



As explained by the explanation:

Release mode is not the line of exception code in the front number, instead it is offset for native compiled code, which does not mean anything to humans. More about this:

Debug Mode in the PDB file will automatically code the code in your CC offset in line and the number displayed in that code will be consistent line. The

offset line numbers in stack trace in release mode, these numbers do not line number Instead of being included in the native compiled code. You can read more about this here:

The only way to get a line number in the stack trace is if you have created code in debug mode with PDB files.


Comments