View Single Post
  #7 (permalink)  
Old December 12th, 2006, 11:33 AM
woodyz woodyz is offline
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ef1196
 Are you sure about this Woody?

The line numbers will definitely appear within the Exception class (Ex.ToString - where Ex is the EXCEPTION) if you are in the development environment, but once the application is compiled and published I have not found this to be the case.

In addition, an Inner Exception is not always produced by the Exception class and can lead to a NULL Reference error if not properly handled within the error routine.

Disclaimer: I'm not proclaiming my point of view to be 100% correct. If I knew everything I wouldn't bother with forums.
First of all, I'm not proclaiming my point of view to be 100% correct, but only that I always THINK I'm 100% correct.

Okay - YES about the line numbers. You must set the "Generate Debugging Information" property to true for each project that you want line numbering for, and then deploy the pdb files with the exe and dll files. This isn't something you want to do all the time, perhaps, but I see no serious reason not to in an internal corporate application, at least until the app is highly stable. There might be some performance hit, but if the project is designed properly this shouldn't be an issue as it will only appear in EXCEPTIONAL cases - that is, when an exception is thrown and needs to be handled so this should be very rare in the normal flow.

And regarding the Inner Exception. The inner exeception is always there if I put it there. Regardless, the code that "unravels" the excpetion has to be written in such a way to deal with all possibilities - so that shouldn't ever be a problem.

We did have a case where in a remoting situation we weren't getting the underlying inner exception but from what I recall we worked that out. So, I am not sure that in our code we have any situation where we can't get at an inner exception where we ourselves have initially generated one. The main focus of my work is a project that, like yours, is large as well. With about 2 million lines of code in the "core" modules, plus numerous optional modules, and code running on various tiers, if we weren't able to easily get at the location of an exception it would be a serious issue.



Woody Z
http://www.learntoprogramnow.com