Solved

Debug VB.NET program on program deployed PC

Posted on 2006-06-24
4
332 Views
Last Modified: 2010-04-23
When I developed program with VB.NET and I can test out or debug the program. That's easy to know where ever it has bug or error. But after building (compiling) it, I deploy to other PC (where it does not have VB development software installed). And when I run the program and if it found error. My issue is that how can I know which program line created the error. In other word, how I trace program running steps.

Any recommendation ? Please !
0
Comment
Question by:mpitak
  • 3
4 Comments
 
LVL 14

Expert Comment

by:ptakja
ID: 16976048
If you deploy the program under a DEBUG build, then any exceptions that are thrown will contain the line numbers in the exception.StackTrace property.

I wrote an error logger component that I use to log application errors, trace messages, informational messages, etc... to a log file on the local PC as well as a database.

You can also log messages to the Windows Event Log with a single line of code. I don't remember the exact syntax, but it is something like EventLog.WriteEntry().

So in your code you could have something like this:

Try
   <put your code here that could throw an exception>
Catch ex As Exception
   Call EventLog.WriteEntry(String.Format("{0}{1}{1}{2}", ex.Message, Environment.Newline, ex.StackTrace))
End Try

0
 

Author Comment

by:mpitak
ID: 17022953
Hello ptakja,

As your suggestion, it will start capturing log after 'Try' command. Can I have log from program started until it's end.
0
 
LVL 14

Expert Comment

by:ptakja
ID: 17023936
Sure. You can call the EventLog.WriteEntry routine anytime to log messages.
0
 
LVL 14

Accepted Solution

by:
ptakja earned 50 total points
ID: 17023937
However, you can't get stack trace information except when an exception is thrown.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

16 Experts available now in Live!

Get 1:1 Help Now