Hi Dave,
the service is working very fine and it also start in Main.
But the Problem is that an unhandelt Execption raise up the JIT-Debugger and
not jump direct to MyHandler.
i have also the problem with an in an Console Application
using System;
namespace SimpleEX
{
class Class1
{
static void Main ( )
{
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler ( MyHandler);
String x = null ;
Console.WriteLine ( x.ToString ( ) ) ; // <---- raise an
exception to the JIT-Debugger not direct to MyHandler
}
static void MyHandler( Object Sender , UnhandledExceptionEventArgs
Args )
{
Exception e = (Exception)Args.ExceptionObject ;
Console.WriteLine ( "Caught : " + e.Message ) ;
}
}
}
the goal is not to raise up the JIT-Debugger!!!
=======================================
"Dave" <kd******@wi.rr.com> schrieb im Newsbeitrag
news:Oh**************@TK2MSFTNGP12.phx.gbl...
If it's a windows service then there's a bunch of code missing from your
sample. I'd guess that even though you think the Main method is getting
called, it really isn't. Windows services use a different mechanism - the
service control manager calls a special entry point. So the code that
hooks the handler is never getting called.
"Mike Strieder" <no****@nobody.com> wrote in message
news:OV*************@TK2MSFTNGP11.phx.gbl... it's in an windows service - there is no Application...
i try also:
System.Threading.Thread.GetDomain().UnhandledExcep tion += new
UnhandledExceptionEventHandler(MyHandler);
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(MyHandler);
"Gheorghe Marius" <cg********@hotmail.com> schrieb im Newsbeitrag
news:up**************@TK2MSFTNGP09.phx.gbl... Hello Mike,
Try using the Application.ThreadException instead of
AppDomain.UnhandledException.
Cheers,
Marius