RE: "not handled in user code" dialog



Jeffery,

I am using Application_Error for the global error handler, and I see the
dialog when I am running under debug. I think the project file is IIS based.
The project shows up as http://localhost.

If the exception is coming from a worker thread, how do I prevent the use of
worker threads. I am not doing any threading inn my code.

Thanks,

Leslie
""Jeffrey Tan[MSFT]"" wrote:

Hi Leslie,

Thanks for your post!

I have several questions regarding your problem context, these questions
will help us to understand your problem much better:
1. How do you implement the global error handler for Asp.net application?
Do you use Application_Error or AppDomain.UnhandledException?
2. While you are seeing this Visual Studio dialog, how do you running your
application? Do you run it under debugging or without debugging?
3. Is your Asp.net project File System based or IIS based?

Based on my experience, Asp.net Application_Error event handler can be used
to handle all the unhandled exception in main Asp.net thread. However, any
worker threads exceptions will not be catched by it. So I suspect that the
exception you have seen is generated in a worker thread.

Also, in FileSystem Asp.net project, since Asp.net is running under the
current account, the unhandled exception dialog will pop up. In IIS mode,
the Asp.net will run under another windows station, and you will not see
this dialog.

Regarding worker thread exception, there is no global exception handler for
it. In 2.0, by default the system will terminate the process if the
unhandled exception is generated in worker thread.(So was main thread,
unless you use Application_Error to handle it). So the only solution is
explicitly catching the first chance exception in that thread procedure, or
the Asp.net process will die.

Finally, there is an AppDomain.UnhandledException in .Net, which seems can
be used for all unhandled exceptions in the AppDomain. However, the
UnhandledException event is merely an event, a notification. The system
uses it to let the programmer know that an exception has gone unhandled,
before the system takes whatever action it wants to take. This event can
not be used to prevent the Asp.net process from die, but it gives you a
notification regarding the die.

If what you want is just getting the notification of the exceptions in
worker thread, you may use AppDomain.UnhandledException.

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • RE: windows services in .net, auto-restarting?
    ... via the native method to stop the service from the worker thread. ... I thought one of the other guys tried throwing an uncaught exception from ... auto-restarting configuration while exceptions are generated in the ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.general)
  • RE: "not handled in user code" dialog
    ... to handle all the unhandled exception in main Asp.net thread. ... exception you have seen is generated in a worker thread. ... Microsoft Online Community Support ...
    (microsoft.public.vsnet.debugging)
  • Re: On Jon Skeets threadpool
    ... Indeed - this is my current exception non-handling strategy - I let ... The worker thread will only wait if the count is 0, ... > multi-threaded class is tricky but unit testing would at least verify the ... Unit testing is one of those things I've always thought is ...
    (microsoft.public.dotnet.general)
  • Re: Exceptions vs. Events
    ... > exceptional situation can arise in the worker thread, ... > throwing an exception probably isn't very clean either. ... The impact of such termination is ... > raise an event letting clients know about the problem. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Error Handling
    ... "Activate the global error handler with a single line of code that simply ... tells our software how to call your subroutine when an exception is ...
    (microsoft.public.access.formscoding)

Loading