Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / March 2007

Tip: Looking for answers? Try searching our database.

Source and Line number logging requires PDB.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Varn - 15 Jan 2007 14:17 GMT
I am using .NET Framework 1.1.

Typically we implement a global exception handler to log any exceptions that
are unexpected.

One of the areas of concern that I have is being able to log exceptions so
that I can get specifics about where the error occurred.  In C++, this could
be done by using  __LINE__,  __FILE__, and __FUNCTION__ macros.

Nothing similar seems to exist when using C#, so I have implemented stack
walking which has worked out fairly well except for one problem.  The PDB
files need to exist on the target machine in order to be able to collect the
line number and function of where an exception is thrown.  Is there any way
to avoid having to place PDB files on the target machine in order to be able
to log exception details?  It would be nice if I could get the line number
and function at compile time like in C++.

Not sure if there is any progress made with this in newer versions of the
framework.

Signature

-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Ollie Riches - 31 Jan 2007 09:25 GMT
Not sure why you have implemented your own stack walking code as this is
available from all exceptions and is defined in System.Exception as method
StackTrace:

http://msdn2.microsoft.com/en-us/library/system.exception.stacktrace.aspx

You are not going to be able to obtain line numbers with a release build,
only debug build (PDB) - surely if code denfensively enough and use an
exception naming strategy you will be able to determine from any error log
where an exception was generated from.

HTH

Ollie Riches

>I am using .NET Framework 1.1.
>
[quoted text clipped - 20 lines]
> Not sure if there is any progress made with this in newer versions of the
> framework.
Barry Kelly - 31 Jan 2007 19:35 GMT
> Not sure why you have implemented your own stack walking code as this is
> available from all exceptions and is defined in System.Exception as method
[quoted text clipped - 4 lines]
> You are not going to be able to obtain line numbers with a release build,
> only debug build (PDB)

PDB works with release build too, if you ask for one (ask for a PDB that
is). However frames may be incorrect for e.g. inlined functions.

-- Barry

Signature

http://barrkel.blogspot.com/

Ken Varn - 12 Mar 2007 16:34 GMT
Are there any security risks in putting the PDB files on the target system?

Signature

-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Ollie Riches wrote:

> Not sure why you have implemented your own stack walking code as this is
> available from all exceptions and is defined in System.Exception as method
[quoted text clipped - 4 lines]
> You are not going to be able to obtain line numbers with a release build,
> only debug build (PDB)

PDB works with release build too, if you ask for one (ask for a PDB that
is). However frames may be incorrect for e.g. inlined functions.

-- Barry

Signature

http://barrkel.blogspot.com/

Barry Kelly - 12 Mar 2007 19:13 GMT
> Are there any security risks in putting the PDB files on the target system?

If the target system is a server, then no, I'm not aware of any risks.
In fact, I've read recommendations of doing so, for the explicit purpose
of getting line numbers.

If it's an end-user system, one possible risk is that PDBs make reverse
engineering easier, because e.g. the PDB contains names for all the
local variables.

-- Barry

Signature

http://barrkel.blogspot.com/


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.