Solved

debug compiled code

Posted on 2004-10-04
9
286 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

631 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