473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

How to make stacktrace include linenumber for release compiles?

Dan
Hi. I've noticed that, when I build an exe in release mode (as opposed to
debug mode), the StackTrace for exception does not include line numbers. Is
there a way that I can build in release mode and still get the line number in
my stack traces?
Sep 26 '06 #1
5 6550
=?Utf-8?B?RGFu?= <Da*@discussions.microsoft.comwrote in
news:37**********************************@microsof t.com:
>
Hi. I've noticed that, when I build an exe in release mode (as
opposed to debug mode), the StackTrace for exception does not include
line numbers. Is there a way that I can build in release mode and
still get the line number in my stack traces?

I believe you have to include the debug PDBs.
Sep 26 '06 #2
Dan
I have figured out how to do it. In project properties "optimizations"
uncheck "enable optimizations". In project properties "build", check
"Generate Debugging Information".

Problem is, to get the line numbers to come out, it seems you've got to
deploy the "pdb" file which gets generated in the build. This seems a bit
insecure. Is there a way you can get the line numbers without deploying the
"pdb" file?
"Dan" wrote:
Hi. I've noticed that, when I build an exe in release mode (as opposed to
debug mode), the StackTrace for exception does not include line numbers. Is
there a way that I can build in release mode and still get the line number in
my stack traces?
Sep 26 '06 #3
Problem is, to get the line numbers to come out, it seems you've got to
deploy the "pdb" file which gets generated in the build. This seems a bit
insecure.
That is my understanding - if you want line numbers, you deploy the .pdb
file, and you in essence you publish your source code. In closed
environments, that is probably ok, but it is not good for commercial products.
Is there a way you can get the line numbers without deploying the "pdb" file?
Here is an experiment you can try if you are up to it. The /Zd and/or /Z7
compiler options talk about line numbers without a .pdb file. During the
compile phase, some extra information is included in the .obj file. Maybe
this information is included in the .exe file, perhaps with an additional
linker option. Maybe the debugger and/or stacktrace will respect the line
number info when it is located in the .exe file vice the .pdb file.

I give this suggestion has a modest probability of success. Debug info in
the .obj file is an older concept than a .pdb file, and I guess that the
older way is no longer supported (a conjecture, not a fact). However, some
digging about compiler and linker options and a few experiments should tell
the tale. My specific guess is that you will be able to get line numbers
into the .exe file but that .net will not use them. If you have any success,
please post back.

Others have raised this problem. My suggestion to MS is to provide /brief
..pdb files for release configuration and /full .pdb files for debug
configuration.

Sep 27 '06 #4
Dan
Thanks for your comments. I agree with you recommendation for MSFT.

I don't see any place to specify such compiler options for a VB.NET project
(at least working from within VS.NET). Am I missing it?

Dan

"AMercer" wrote:
Problem is, to get the line numbers to come out, it seems you've got to
deploy the "pdb" file which gets generated in the build. This seems a bit
insecure.

That is my understanding - if you want line numbers, you deploy the .pdb
file, and you in essence you publish your source code. In closed
environments, that is probably ok, but it is not good for commercial products.
Is there a way you can get the line numbers without deploying the "pdb" file?

Here is an experiment you can try if you are up to it. The /Zd and/or /Z7
compiler options talk about line numbers without a .pdb file. During the
compile phase, some extra information is included in the .obj file. Maybe
this information is included in the .exe file, perhaps with an additional
linker option. Maybe the debugger and/or stacktrace will respect the line
number info when it is located in the .exe file vice the .pdb file.

I give this suggestion has a modest probability of success. Debug info in
the .obj file is an older concept than a .pdb file, and I guess that the
older way is no longer supported (a conjecture, not a fact). However, some
digging about compiler and linker options and a few experiments should tell
the tale. My specific guess is that you will be able to get line numbers
into the .exe file but that .net will not use them. If you have any success,
please post back.

Others have raised this problem. My suggestion to MS is to provide /brief
.pdb files for release configuration and /full .pdb files for debug
configuration.
Sep 27 '06 #5
I don't see any place to specify such compiler options for a VB.NET project
(at least working from within VS.NET). Am I missing it?
Probably not. I'm on shaky ground here, but you probably have to leave the
confines of VS.NET. This raises the question of whether the experiment is
worth the trouble given its low (my estimate) probablity of success.

As I said before, you are not the first to raise this issue. I wish someone
from MS would give some guidance. Is anybody listening? Maybe an MVP can
make a most valuable contribution - after all, that is why they pay the MVPs
the big bucks (just kidding). Who knows - maybe MS is about to release a
..net upgrade that includes a .pdb with options.

Sorry, I don't have any answers, only an open ended experiment of dubious
value.
Sep 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: | last post by:
Hi, I'm experiencing a bizar problem with MS VC++, and just can't figure out what's going on. I Build a solution that compiles pretty well, it works good when I launch it in the Visual C++ Editor...
2
by: brianlanning | last post by:
I'm trying to write a function that can reliably know the name of the calling method. I've figured out how to do this: string methodname = (new StackTrace()).GetFrame(1).GetMethod().Name; ...
1
by: Bhavesh Padmani | last post by:
Hello, Currenlty we use ISAPI DLLS on our site. These dlls are making rpc calls to another NT services on that same machine. I am planning to use C++ web service using .NET 2003 instead of ISAPI...
1
by: Eric M L | last post by:
I am wondering if I am alone with this problem. Using VS 2005, I must validate an XML file via a Schema and it works well. When I get the schema exception and check the LineNumber and...
0
by: Kieran Toon | last post by:
I'm using Visual Studio 2005 and have an ASP.NET web application written in Visual Basic. When the application runs on my local webserver and hits an error, my errorhandler writes out debug...
12
by: Zytan | last post by:
I use System.Diagnostics.StackTrace to get the stack trace of the current function, to print out the function's name to the log, and sometimes it shows that a function that doesn't even write to...
0
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, when my web application throws an unhandled exception in debug mode I redirect to an error page and show the error message and the stack trace. The stack trace includes the name of the page...
6
by: Kristijan Marin | last post by:
Hi, Can please anyone tell me why do i get only the first method in which the exception was thrown and not the line that triggered the exception ? I don't know if I set something in VS2005 wrong...
0
by: Diainwater | last post by:
Hello... When releasing, PDB files must put in current directory to get line information of stacktrace? If it dose, is it fine to release with PDB? I mean it's easier to guess source code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.