Groups | Blog | Home
all groups > dotnet clr > august 2003 >

dotnet clr : Help! I need to prevent .NET exception dialogs from displaying.


David Browne
8/25/2003 5:41:06 PM

[quoted text, click to view]

You should prevent unattended applications from throwing unhandled
exceptions.

In your Main, and any ThreadProc, and any method which is the target of a
callback, run all code inside a try/catch block, log the exception and/or
write an event and let the method terminate.

David

Ken Varn
8/25/2003 6:04:51 PM
I have an unattended 24/7 system that runs a few .NET applications. I
really need to prevent any unhandled exceptions from displaying the
exception dialog box. I want the application to just terminate. This was
available with Dr. Watson, but I can't figure out how to do it for .NET
apps. Can someone please tell me how to disable .NET exception dialogs? No
code changes please. I would prefer registry setting if possible.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
-----------------------------------

Ken Varn
8/26/2003 9:51:45 AM
I keep getting the same response for this question. Please read the
original question. Changing the source for some of the applications is not
an option. I want what was available with Dr. Watson. I want to disable
all .NET unhandled exception dialogs. Is there a way to do this?

Developers at Microsoft need to realize that just because they do not think
a feature is worth keeping around, doesn't mean that the rest of the
programming world doesn't use it.

Sorry for spouting off, but this is really getting aggravating.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
-----------------------------------
"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:%23Uvz5n1aDHA.2404@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

Marc Scheuner [MVP ADSI]
8/27/2003 10:13:39 AM
[quoted text, click to view]

Well, maybe you keep getting the same answer because that's the only
answer that works ! I don't see any way to simply suppress all
exception dialogs - either *YOU* handle them in your code, or they'll
pop up.

Can't have the cake and eat it, too !

Marc
================================================================
Marc Scheuner May The Source Be With You!
Uri Dor
8/27/2003 4:59:06 PM
can't you write a "loader" utility which uses Reflection.Assmbly to load
your app and run it (unchanged), enclosed in a try-catch?

[quoted text, click to view]
David Browne
9/5/2003 4:45:37 PM

[quoted text, click to view]

Don't use them for purposes for which they weren't designed.
If they allow popups, then they weren't designed for unattended execution.

[quoted text, click to view]

It is simply unacceptable for an unattended application to generate a popup,
and unacceptable to incorporate any application that does into an unattended
system.

Now that being said Dr.Watson wasn't made of magic. You can enumerate
processes and windows and read window text and send window messages that
correspond to button clicks. It's just not easy.

David

Ken Varn
9/5/2003 5:46:50 PM
Well, put this in the suggestion box. It was available with regular C++
programming through Dr. Watson. It would seem there is no equivalent
exception handling application.

What would you propose that I do for .NET applications that are 3rd party?
I can't guarantee that all applications handle all exceptions. My system is
a critical 24/7 system that is unattended. When these pop-up dialogs
appear, it suspends operations until someone acknowledges the modal dialog
box. This is unacceptable for an unattended system.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
-----------------------------------
[quoted text, click to view]

Marc Scheuner [MVP ADSI]
9/8/2003 8:11:21 AM
[quoted text, click to view]

One way would be to write a small C# "loader" that would load /
execute those third-party apps/components, and that would implement a
"catch-all" exception handler that would catch, record, and "swallow"
all exceptions that show up.

However, if the third-party app *itself* catches an exception and
displays an error message box, you're out of luck - you won't be able
to change the behaviour of that app from the outside, I'd say.

Not sure if maybe the MS Exception Handling Application Block could be
of use to you, too - I've looked at it, but it looked rather
complicated and convoluted, so I backed off - it should allow you to
define certain ways of handling exceptions (e.g. by just recording
them to a log file etc.).

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/emab-rm.asp

Marc
================================================================
Marc Scheuner May The Source Be With You!
Ken Varn
9/9/2003 11:55:13 AM
I am not talking about trapping all dialog boxes and error messages. I
merely want to stop the display of the unhandled exception dialog that the
clr displays. That does not seem to be asking too much. If for some reason
an application left out a catch for unhandled exceptions, there should be a
way for the clr unhandled exception handler settings to be modified (outside
of source code) to not display the dialog box and just log the error to the
event viewer.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
-----------------------------------
"David Browne" <davidbaxterbrowne no potted meat@hotmail.com> wrote in
message news:%23DOZNc$cDHA.3520@tk2msftngp13.phx.gbl...
[quoted text, click to view]

Ken Varn
9/9/2003 11:57:02 AM
I'll look into these suggestions. Thanks.

I still think that Microsoft should have provided a registry setting or
something to disable the clr unhandled exception dialog box.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
-----------------------------------
[quoted text, click to view]

Ben Blair
9/15/2003 3:36:20 PM
Ken,
Look under:
HKLM\SOFTWARE\Microsoft\NETFramework
The DbgManagedDebugger value determines which program runs
when an unhandled exception is thrown. Also, look at the
DbgJITDebugLaunchSetting value. Setting this value to 0
will bring up the default message box. 1 will prevent the
JIT handler from running. 2 will cause the program to try
to keep running.

If the unhandled exception is a Win32 exception, look at
HTML\Software\Microsoft\Windows NT\CurrentVersion\AeDebug
key.

See O'Reilly's excellent Mastering Visual Studio.NET (p86)
for more details.

Hope this helps.

- Ben Blair
- benblair@Association for Computing Machinery dot org

[quoted text, click to view]
===========================================================
=====
[quoted text, click to view]
Ken Varn
9/16/2003 8:34:52 AM
Finally my question is answered! Thank you! Thank you!

This is exactly what I was looking for.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
-----------------------------------
"Ben Blair" <benblair@Association_for_Computing_Machinery.org> wrote in
message news:39ae01c37bd9$c9121130$a501280a@phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button