Solved

debug compiled code

Posted on 2004-10-04
9
285 Views
Last Modified: 2008-03-03
Hi,

I run an online app using classes in a dll that i wrote to execute business logic and data access.  The thing is, whenever there is an error in the code inside the dll, it only shows the error on the line in my aspx that calls the method in the dll.  Is there an easier way to debug, and get the specific error out of the compiled dll?  I realize the original code isn't actually inside the dll, but I'm wondering if any of you experts have a better method of debugging?

Thanks,
Trevor
0
Comment
Question by:trevorhartman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 12219704
how are you handling the errors?  try/catch code please (especially the catch part) :-)
0
 
LVL 8

Author Comment

by:trevorhartman
ID: 12221607
I'm not handling the errors.. there shouldn't be errors in the code that i'm writing, but of course WHILE i'm writing it, I make mistakes and need to debug...  
0
 
LVL 5

Expert Comment

by:stumpy1
ID: 12225340
I take from your post that you arent using Visual Studio or some other IDE that allows you interactive debugging?

As raterus suggests you could use try/catch code (you probably should have error-handling code in there anyway).

You could also enable tracing within the application to assist you.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:trevorhartman
ID: 12229309
maybe i need to start using visual studio..  i'll use this as another reason to do so, and maybe i'll be able to convince my boss :)

as far as try catch goes, i do things like float.Parse(mySqlParamter.Value.ToString()) and sometimes if i don't get a value back from the db, i'll get an error.  there should never be a case where i don't get something back from the database though, so I shouldn't HAVE to do a try catch, should I?  Is it just good practcice?

Thanks,

Trevor
0
 
LVL 5

Assisted Solution

by:stumpy1
stumpy1 earned 125 total points
ID: 12236162
Error handling is always good practice! Even if its only very simple error handling.
You say, "there should never be a case where i don't get something back from the database though," this is exactly why you should have error_handling, in case for some god knows reason that 1 instance happens and your application falls over.

Here is a link to MS about custom error handling in ASP.Net
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/customerrors.asp
0
 
LVL 33

Accepted Solution

by:
raterus earned 125 total points
ID: 12236946
For production apps, you usually don't want people seeing the original error message (they don't need to debug YOUR application!)  What I do is throw all the errors up to application_error, which I think email the error to myself, and redirect them to an error page that states an error occurred.  The best use I have of try/catch is when I'm opening a DB connection, doing something (that may break) then closing the connection.  I always make it look like this

try
  conn.open
  'do some db work
catch ex as sqlexception
  throw
finally
  conn.close
end try

with the conn.close being in the finally block, my connections will always be closed, even if an error occurs.

--Michael
0
 
LVL 8

Author Comment

by:trevorhartman
ID: 12245442
how do you throw an error up to the application level?
0
 
LVL 5

Expert Comment

by:stumpy1
ID: 12246995
Here is a MS link with example code about throwing exceptions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconthrowingexceptions.asp

If you dont have error handling then the error will automatically filter up to the next level. If there isnt eny error handling to catch the error then the error is thrown to the browser.

Heres another MS link about Handling and Throwing Exceptions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconHandlingThrowingExceptions.asp
0
 
LVL 8

Author Comment

by:trevorhartman
ID: 12251248
thanks for the links and info guys..

-Trevor
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question