Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

debug compiled code

Posted on 2004-10-04
9
Medium Priority
?
288 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
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 500 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 500 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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 …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

885 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