Suppress JIT Debugger?

M

Mark Olbert

I have a custom exception handler that "wraps" an entire application. Basically, all it does is make
things easier on my beta testers by letting them click a button to copy all the information I want
on an exception to the clipboard, from where they can paste it into an email to me. This works fine
on my development machine when I'm running the app under the VS debugger.

However, on my testers' machines, which don't have VS installed, they don't see my handler; they see
a request asking them if they want to invoke the JIT debugger. I'd prefer that they not see this.

Is there a way to suppress the Framework's request to invoke the JIT debugger when an exception
occurs?

- Mark
 
G

Guest

Try setting up debug versus production code rather than suppressing the JIT
compiler. Remember that HIT compilation is necessary for apps, unless you
native compile.

---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************
Think outside the box!
************************************
 
M

Mark Olbert

Sorry, that won't work in my situation at this point. I need to keep building and distributing the
debug code.

I'm not trying to suppress JIT >>compilation<<, just the "do you want to invoke the JIT Debugger?"
window that pops up when the app crashes. I have my own custom "global exception handler" form that
I want to appear, instead.

- Mark
 
S

saurabh

"First chance exception"

You application is the first to get the chance to see the exception but
there are circumstances where it does not happen. I am sure you have caught
Exception at top level so that nothing gets filtered through.

The other thing is, in winforms if one of your dialog throws an exception,
and you are catching it in the code which launched the form, the JIT
debugger gets there before you thinking that the exception is going
unhandled. you also need 2 more things they are

1) Subscribe to the UnhandledException event on your AppDomain to catch any
exception as follows :
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

2) Catch the thread exceptions that might have been thrown from the
Winforms thread.
System.Windows.Forms.Application.ThreadException += new
ThreadExceptionEventHandler(Application_ThreadException);

This will ensure that your dialog always gets invoked (of course if you
write relevant code in the above 2 handlers ;))

Since after getting these exceptions, your application *may* be in an
undetermined state so quite a few people recommend closing the application
if you get these exceptions.

HTH,

--Saurabh
 
S

saurabh

Why was this reply lost yesterday ? Its definitely there in my sent messages
-----------------------------------------
"First chance exception"

You application is the first to get the chance to see the exception but
there are circumstances where it does not happen. I am sure you have caught
Exception at top level so that nothing gets filtered through.

The other thing is, in winforms if one of your dialog throws an exception,
and you are catching it in the code which launched the form, the JIT
debugger gets there before you thinking that the exception is going
unhandled. you also need 2 more things they are

1) Subscribe to the UnhandledException event on your AppDomain to catch any
exception as follows :
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

2) Catch the thread exceptions that might have been thrown from the
Winforms thread.
System.Windows.Forms.Application.ThreadException += new
ThreadExceptionEventHandler(Application_ThreadException);

This will ensure that your dialog always gets invoked (of course if you
write relevant code in the above 2 handlers ;))

Since after getting these exceptions, your application *may* be in an
undetermined state so quite a few people recommend closing the application
if you get these exceptions.

HTH,

--Saurabh
 
M

Mark Olbert

Don't know. FWIW, I saw it. Thanx!

- Mark

Why was this reply lost yesterday ? Its definitely there in my sent messages
-----------------------------------------
"First chance exception"

You application is the first to get the chance to see the exception but
there are circumstances where it does not happen. I am sure you have caught
Exception at top level so that nothing gets filtered through.

The other thing is, in winforms if one of your dialog throws an exception,
and you are catching it in the code which launched the form, the JIT
debugger gets there before you thinking that the exception is going
unhandled. you also need 2 more things they are

1) Subscribe to the UnhandledException event on your AppDomain to catch any
exception as follows :
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

2) Catch the thread exceptions that might have been thrown from the
Winforms thread.
System.Windows.Forms.Application.ThreadException += new
ThreadExceptionEventHandler(Application_ThreadException);

This will ensure that your dialog always gets invoked (of course if you
write relevant code in the above 2 handlers ;))

Since after getting these exceptions, your application *may* be in an
undetermined state so quite a few people recommend closing the application
if you get these exceptions.

HTH,

--Saurabh
 

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