"Runtime error" message box

G

Guest

We are working on an application that runs as a service. Due to its complexity, we occasionally experience crashes. In the past, we have been able to simply log these crashes in our logs, create a Dr. Watson log, and automatically restart our service

Ever since we started to use VS .NET, though, we occasionally expericence an annoying problem. Every now and then, a message box titled "Microsoft Visual C++ Runtime Library" pops up, with the following content

"Runtime Error

"Program: <name of application

"This application has requested the Runtim to terminate it in an unusual way. Please contact the application's support team for more information.

and an "OK" button

The app doesn't exit (and hence, restart) until the OK button is pushed. Since it typically runs unattended on a computer that doesn't even have a screen attached, this is not a happy situation. Is there any way to disable this message box? Any suggestions are much appreciated

Gregor Nitsch
RAF Technology, Inc.
 
G

Guest

Additional info

- The service is set up to run from the system account, "Allow service to interact with desktop" is not checked
- From the documentation in MSDN, it appears that __set_error_mode() would do the trick. However, from testing it, it appears that assert(0) always generates both output in stderr and a message box regardless of the value set

----- Gregor Nitsche wrote: ----

We are working on an application that runs as a service. Due to its complexity, we occasionally experience crashes. In the past, we have been able to simply log these crashes in our logs, create a Dr. Watson log, and automatically restart our service

Ever since we started to use VS .NET, though, we occasionally expericence an annoying problem. Every now and then, a message box titled "Microsoft Visual C++ Runtime Library" pops up, with the following content

"Runtime Error

"Program: <name of application

"This application has requested the Runtim to terminate it in an unusual way. Please contact the application's support team for more information.

and an "OK" button

The app doesn't exit (and hence, restart) until the OK button is pushed. Since it typically runs unattended on a computer that doesn't even have a screen attached, this is not a happy situation. Is there any way to disable this message box? Any suggestions are much appreciated

Gregor Nitsch
RAF Technology, Inc.
 
D

DotNetJunkies User

Two things could be wrong. First, a virus corrupted the file referred to in the runtime error message. If this is the case (and this is the first thing you should try to solve this problem), run at least two separate virus checkers (I use Norton’s Anti Virus and Panda) after you have updated the programs with the newest downloads. Run the virus program you have on your hard drive in Safe Mode (this sometimes eliminates viruses that can’t be deleted in normal mode).
After you are sure your disk is virus free, check and see if this eliminated the error and the problem caused by the error (it probably didn’t, right?).
Second, run System File Checker. This is a program that not only checks for corrupted/missing files, but fixes them. Start SFC from the Start/Run command. Type in sfc /scannow (remember to put a space between the c and the forward slash). After the program finishes running, reboot your computer.
This fix has worked in the majority of the runtime error cases I’ve experienced. Sometimes, it doesn’t work and you’ll have to dig a little deeper to find the cause.
(In my latest runtime error case, I had the following message: Visual C++ Runtime library error. Program: C\Windows\explorer.exe. Running SFC eliminated the runtime error message, but the problem with accessing disks in Explorer persisted. I found out that the problem was with a corrupted file in Iomega zip drive software—this program substitutes it’s own drop down list when accessing a drive in Explorer/My Computer—so when I tried to, for instance, format a disk in my floppy drive the screen would go blank for a few seconds and then revert to the desktop). I solved the problem by deleting and then reinstalling the Iomega software.
I’ve found that the problem of runtime errors can almost always be solved by just reading the entire text of the warning and then concentrating your efforts on doing everything feasible to the program in question. If your having problems with a add-on program that can be deleted and reinstalled, do that. If it’s a Window-based program, odds are SFC will take care of it.
If nothing you’ve tried works, then it’s time to invoke the dreaded Recovery Console fix. I say dreaded because this program can sometimes create more problems that it solves—proceed with caution!
I hope any or all of this advice solves your problem.
Hyjanks
 
D

DotNetJunkies User

Two things could be wrong. First, a virus corrupted the file referred to in the runtime error message. If this is the case (and this is the first thing you should try to solve this problem), run at least two separate virus checkers (I use Norton’s Anti Virus and Panda) after you have updated the programs with the newest downloads. Run the virus program you have on your hard drive in Safe Mode (this sometimes eliminates viruses that can’t be deleted in normal mode).
After you are sure your disk is virus free, check and see if this eliminated the error and the problem caused by the error (it probably didn’t, right?).
Second, run System File Checker. This is a program that not only checks for corrupted/missing files, but fixes them. Start SFC from the Start/Run command. Type in sfc /scannow (remember to put a space between the c and the forward slash). After the program finishes running, reboot your computer.
This fix has worked in the majority of the runtime error cases I’ve experienced. Sometimes, it doesn’t work and you’ll have to dig a little deeper to find the cause.
(In my latest runtime error case, I had the following message: Visual C++ Runtime library error. Program: C\Windows\explorer.exe. Running SFC eliminated the runtime error message, but the problem with accessing disks in Explorer persisted. I found out that the problem was with a corrupted file in Iomega zip drive software—this program substitutes it’s own drop down list when accessing a drive in Explorer/My Computer—so when I tried to, for instance, format a disk in my floppy drive the screen would go blank for a few seconds and then revert to the desktop). I solved the problem by deleting and then reinstalling the Iomega software.
I’ve found that the problem of runtime errors can almost always be solved by just reading the entire text of the warning and then concentrating your efforts on doing everything feasible to the program in question. If your having problems with a add-on program that can be deleted and reinstalled, do that. If it’s a Window-based program, odds are SFC will take care of it.
If nothing you’ve tried works, then it’s time to invoke the dreaded Recovery Console fix. I say dreaded because this program can sometimes create more problems that it solves—proceed with caution!
I hope any or all of this advice solves your problem.
Hyjanks
 
R

robscanlon

Any progress on this problem? I am in the exact same situation (tryin
to run as a service but it hangs because of the popup). Can't seem t
find any way to handle the ScriptControl exception in vb.net.

Thanks!
Rob Scanlo


-
robscanlo
 
W

William DePalo [MVP VC++]

Gregor Nitsche said:
We are working on an application that runs as a service.
Due to its complexity, we occasionally experience crashes.
In the past, we have been able to simply log these crashes
in our logs, create a Dr. Watson log, and automatically
restart our service.

Ever since we started to use VS .NET, though, we occasionally
expericence an annoying problem. Every now and then, a
message box titled "Microsoft Visual C++ Runtime Library"
pops up, with the following content:

I've seen this question pop up a couple of times. At the risk of sounding
too glib, the best course, of course, is to fix the problem before you
deploy. :)

Of course we all make errors occaisionally an that is not always possible.

I'm not sure about this but I think that the message is issued in the module
"crtmbox.c" where there are these lines:

if (fNonInteractive)
{
if (_winmajor >= 4)
uType |= MB_SERVICE_NOTIFICATION;
else
uType |= MB_SERVICE_NOTIFICATION_NT3X;
}

In other words, it looks as though the code specifically checks if the
caller is running on a non-interactive desktop and then sets the message box
flags so that they get displayed on the console despite the fact that a
service is involved. Again, assuming I have the cause right, there is an
implicit assumption that the error is so bad as to warrant user
intervention.

If I'm right about that, and if that's not the case for you then perhaps you
want to research ways of using a custom version of that function which does
not invoke MessageBox(). Of course, if things are _really_ bad you may not
be able to do much.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top