Solved

debug compiled code

Posted on 2004-10-04
9
281 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
  • 4
  • 3
  • 2
9 Comments
 
LVL 33

Expert Comment

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

Author Comment

by:trevorhartman
Comment Utility
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
Comment Utility
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
 
LVL 8

Author Comment

by:trevorhartman
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 5

Assisted Solution

by:stumpy1
stumpy1 earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
how do you throw an error up to the application level?
0
 
LVL 5

Expert Comment

by:stumpy1
Comment Utility
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
Comment Utility
thanks for the links and info guys..

-Trevor
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Help needed on website authentication 7 47
Javascript newbie 5 36
Problem to Popup 37 76
Asp/Net Validation date Issue 9 36
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now