Note that there are some explanatory texts on larger screens.

plurals
  1. POException error message with incorrect line number
    text
    copied!<p>When an exception is thrown in an Asp.Net web page, an error message is displayed with the complete stack trace. </p> <p>Example below: </p> <blockquote> <p>Stack Trace: <br/> IndexOutOfRangeException: Index was outside the bounds of the array. <br/><br/> <strong>MyNameSpace.SPAPP.ViewDetailsCodeBehind.LoadView() +5112</strong> MyNameSpace.SPAPP.ViewDetailsCodeBehind.Page_Load(Object sender, EventArgs e) +67<br/> System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13<br/> System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +43<br/> System.Web.UI.Control.OnLoad(EventArgs e) +98<br/> ... ...</p> </blockquote> <p>The problem is that the Line number displayed does not correspond to the line in my code that originated the exception.<br/> In the example above, the stack shows line number 5111, yet my code behind .cs file only has 250 lines!</p> <p>The aspx page is stored in a SharePoint site and the Assembly with the code behind has been deployed to GAC. Also, I've compiled in Debug mode.<br/><br/> <strong>Given the settings above, how can I find out what line in my code caused the Exception?<br/></strong></p> <p><br/> <br/> <em>Clarification as pointed out by <a href="https://stackoverflow.com/users/2788/strelokstrelok">strelokstrelok</a>:</em></p> <blockquote> <p>In <strong>Release mode</strong> the number in front of the exception is NOT the line of code. Instead it's an offset to the native compiled code, which doesn't have any meaning to humans. More about this here: <a href="http://odetocode.com/Blogs/scott/archive/2005/01/24/963.aspx" rel="nofollow noreferrer">http://odetocode.com/Blogs/scott/archive/2005/01/24/963.aspx</a></p> <p>In <strong>debug mode</strong> the PDB file will automatically map the native code offset to your .cs line in code and the number displayed WILL be the corresponding line in code.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload