Unhandled Exception Handler

  • Thread starter Thread starter zacks
  • Start date Start date
Z

zacks

We have an application in use at several dozen of our customers. At
one customer site, it behaves strangely. The same application runs
three times with three different config files passed to it on the
command line. I have a BAT file that runs the application thussly. I
then have the BAT file scheduled to run as a scheduled task. The task
runs fine manually, but when it runs on the schedule, each invocation
of the application in the BAT file dies with an exception that is
getting logged in the Application EventLog. It is a very cryptic
message:

EventType clr20r3, P1 udm.exe, P2 1.0.71.0, P3 46d48a47, P4
system.windows.forms, P5 2.0.0.0, P6 4333aefa, P7 47f1, P8 96, P9
system.invalidoperationexception, P10 NIL.

This means nothing to me. I did some research with Google and didn't
turn up much that was particularly useful to me. One suggestion I
think may help is to add an Unhandled Exception handler to the app so
that I might be able to get a better message in the event log, but I
am wondering just where in the code should I put it?

The application is a Windows Application that has a Sub Main as the
startup object. If there are command line switches, the main form is
not even shown. Whether the main form is shown or not, the actual work
the application does is done by a class library.

So, do I need to add the handler to the Sub Main or in the class
library?
 
If things run okay manually, then to me it points to something in how the
scheduler is handling things. What are you using for a scheduler?
 
If things run okay manually, then to me it points to something in how the
scheduler is handling things. What are you using for a scheduler?

The builtin Windows Scheduler in the Control Panel.
 
Carefull ithe win scheduler will kill apps if they run longer than X time by
default...
Check the settings tab.

Schneider
 
Just a guess--I would investigate user permissions or script disabling
on the problem computer.

Mark Lincoln
 
Since nobody seems to have actually answered your question...
Double click "My Project" and on the 'Application Tab' click the 'View
Application Events' button. On the dropdown list under the tab, select
'MyApplication Events' and on the dropdown list to the right, select
'UnhandledException' event. Add your code to the sub it generates.
 
Back
Top