error line number

  • Thread starter Thread starter Rotsey
  • Start date Start date
R

Rotsey

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
 
Rotsey said:
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?????

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/#LineNumberMethodName>
 
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
 
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:
http://www.mztools.com
 
Back
Top