By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

error line number

P: n/a
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
Apr 3 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Rotsey" <ma***********@RemoveThis.optusnet.com.au> schrieb:
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>

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

Apr 3 '06 #2

P: n/a
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

Apr 3 '06 #3

P: n/a
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
"Rotsey" <ma***********@RemoveThis.optusnet.com.au> escribió en el mensaje
news:u1**************@TK2MSFTNGP10.phx.gbl...
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

Apr 5 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.