error line number

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rotsey

    error line number

    Hi,

    I am trying to write some error handling code to log the error.
    But getting the line number of the error is not simple.

    Is it because the app is set to "Release" and does not have debug info.

    Is there a way of getting the line number when in release mode?????

    Thanks


  • Herfried K. Wagner [MVP]

    #2
    Re: error line number

    "Rotsey" <malcolm_smith@ RemoveThis.optu snet.com.au> schrieb:[color=blue]
    > I am trying to write some error handling code to log the error.
    > But getting the line number of the error is not simple.
    >
    > Is it because the app is set to "Release" and does not have debug info.
    >
    > Is there a way of getting the line number when in release mode?????[/color]

    I don't know of a way. However, you could manually insert line numbers for
    debugging purposes:

    <URL:http://dotnet.mvps.org/dotnet/code/techniques/#LineNumberMeth odName>

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Shane

      #3
      Re: error line number

      This works under 2003, I haven't loaded 2005 yet.

      Menu
      Project -> Properties

      Set Configuration to Release
      Conifiguration Properties -> Build
      Check "Generate Debugging Information"

      You will need to include the generated ".pdb" file with your
      application. I haven't noticed any speed decrease.

      Your error handler code can include ex.stacktrace in a message box,
      which is fantastic for finding an offending line of code, and how it
      got there.

      Shane

      Comment

      • Carlos J. Quintero [VB MVP]

        #4
        Re: error line number

        Supposedly the Release configuration should not generate a .pdb file since
        at that point the app should have been tested (using the Debug
        configuration). If you want line numbers at Release configuration without
        the .pdb file you have to add them to the code and use the Erl function
        (like in VB6). My add-in has a feature to add line numbers to the code.

        --

        Best regards,

        Carlos J. Quintero

        MZ-Tools: Productivity add-ins for Visual Studio
        You can code, design and document much faster:
        MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.



        "Rotsey" <malcolm_smith@ RemoveThis.optu snet.com.au> escribió en el mensaje
        news:u1QL1nxVGH A.5064@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Hi,
        >
        > I am trying to write some error handling code to log the error.
        > But getting the line number of the error is not simple.
        >
        > Is it because the app is set to "Release" and does not have debug info.
        >
        > Is there a way of getting the line number when in release mode?????
        >
        > Thanks
        >[/color]


        Comment

        Working...