Link to home
Start Free TrialLog in
Avatar of mpitak
mpitak

asked on

Debug VB.NET program on program deployed PC

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 !
Avatar of ptakja
ptakja
Flag of United States of America image

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

Avatar of mpitak
mpitak

ASKER

Hello ptakja,

As your suggestion, it will start capturing log after 'Try' command. Can I have log from program started until it's end.
Sure. You can call the EventLog.WriteEntry routine anytime to log messages.
ASKER CERTIFIED SOLUTION
Avatar of ptakja
ptakja
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial