Exception error message has wrong line number

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QXJ0aHVyIFBhcmtlcg==?=

    #1

    Exception error message has wrong line number

    I've been having a problem occasionally with exceptions having the wrong line
    number listed. The situation is this:
    I have a function with a try-catch, and in the catch it logs the message and
    stack trace from the exception. The code generates an index-out-of-bounds
    exception. When I look at the line number listed in the stack trace, it is
    the first line of code in the function, which has nothing to do with array
    indexes. One time this happened, I had to add a debug variable that kept
    track of which section of code was executing and add that to the error
    message.
    I've had this happen several times with different code, and different
    functions, but always an index-out-of-bounds, and always pointing to the
    first line of the code inside the try block.
    Does anyone have an explanation for this odd behavior?
  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: Exception error message has wrong line number

    This is just a guess, but it is possible that you may have changed your code
    but the .pdb file was not rebuilt. Try using "Rebuild" instead of "Build"
    -- Peter
    Site: http://www.eggheadcafe.com
    UnBlog: http://petesbloggerama.blogspot.com
    MetaFinder: http://www.blogmetafinder.com


    "Arthur Parker" wrote:
    I've been having a problem occasionally with exceptions having the wrong line
    number listed. The situation is this:
    I have a function with a try-catch, and in the catch it logs the message and
    stack trace from the exception. The code generates an index-out-of-bounds
    exception. When I look at the line number listed in the stack trace, it is
    the first line of code in the function, which has nothing to do with array
    indexes. One time this happened, I had to add a debug variable that kept
    track of which section of code was executing and add that to the error
    message.
    I've had this happen several times with different code, and different
    functions, but always an index-out-of-bounds, and always pointing to the
    first line of the code inside the try block.
    Does anyone have an explanation for this odd behavior?

    Comment

    • =?Utf-8?B?QXJ0aHVyIFBhcmtlcg==?=

      #3
      RE: Exception error message has wrong line number

      That's possible, although I went through several changes and re-compilations,
      so the pdb file should have been updated during the process. The especially
      odd part is that I haven't noticed this behavior with any other kind of
      exceptions.

      "Peter Bromberg [C# MVP]" wrote:
      This is just a guess, but it is possible that you may have changed your code
      but the .pdb file was not rebuilt. Try using "Rebuild" instead of "Build"
      -- Peter
      Site: http://www.eggheadcafe.com
      UnBlog: http://petesbloggerama.blogspot.com
      MetaFinder: http://www.blogmetafinder.com

      Comment

      Working...