示例如下:
Stack Trace:
IndexOutOfRangeException: Index was outside the bounds of the 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
… …
问题是显示的行号与我的代码中引发异常的行不对应.
在上面的例子中,堆栈显示行号5111,但我的.cs文件后面的代码只有250行!
aspx页面存储在SharePoint站点中,带有代码的程序集已部署到GAC.另外,我已经在Debug模式下编译了.
鉴于上面的设置,我如何找出代码中的哪一行导致异常?
strelokstrelok指出的澄清:
In Release mode 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: 07001
In debug mode 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.