473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

UnhandledException

i want to catch all execeptions with my own handler, but the problem is,
that the JIT-Debugger always start!
i put also the <system.windows.forms jitDebugging="false" /> in the
machine.config
thx for help

Mike

using System;

namespace SimpleEX
{
class Class1
{
static void Main ( )
{
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler ( SimpleHandler);

String x = null ;
Console.WriteLine ( x.ToString ( ) ) ;
}

static void SimpleHandler ( Object Sender ,
UnhandledExceptionEventArgs Args )
{
Exception e = (Exception)Args.ExceptionObject ;
Console.WriteLine ( "Caught : " + e.Message ) ;
}
}
}


Nov 15 '05 #1
7 7493
Hello Mike,

Try using the Application.ThreadException instead of
AppDomain.UnhandledException.

Cheers,
Marius

Nov 15 '05 #2
Hello Mike,

Try using the Application.ThreadException instead of
AppDomain.UnhandledException.

Cheers,
Marius

Nov 15 '05 #3
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


Nov 15 '05 #4
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


Nov 15 '05 #5
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



Nov 15 '05 #6
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



Nov 15 '05 #7
Check this setting!
HKLM\Software\Microsoft\.NetFramework\DbgJitDebugL aunchSetting

"Mike Strieder" <no****@nobody.com> schrieb im Newsbeitrag
news:ec*************@TK2MSFTNGP09.phx.gbl...
i want to catch all execeptions with my own handler, but the problem is,
that the JIT-Debugger always start!
i put also the <system.windows.forms jitDebugging="false" /> in the
machine.config
thx for help

Mike

using System;

namespace SimpleEX
{
class Class1
{
static void Main ( )
{
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler ( SimpleHandler);

String x = null ;
Console.WriteLine ( x.ToString ( ) ) ;
}

static void SimpleHandler ( Object Sender ,
UnhandledExceptionEventArgs Args )
{
Exception e = (Exception)Args.ExceptionObject ;
Console.WriteLine ( "Caught : " + e.Message ) ;
}
}
}

Nov 15 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marcio Izepe | last post by:
I am with a problem that I do not obtain to understand. I put a method in the UnhandledException event of AppDomain to capture and log exceptions, however it does not pass for it when I am working...
0
by: Mike Strieder | last post by:
i want to catch all execeptions with my own handler, but the problem is, that the JIT-Debugger always start! i put also the <system.windows.forms jitDebugging="false" /> in the machine.config ...
4
by: Thom Little | last post by:
I have a simple C# Winforms application that has an UnhandledException handler that writes to the log. This works fine if I throw a new exception (like"bogus") but it does not gain control on a...
5
by: John Richardson | last post by:
Quick question about the UnhandledException event and associated Handler. I just implemented this handler for the first time, and am surprised that it this event is being raised for an exception...
4
by: Groundskeeper | last post by:
I can't seem to get a custom UnhandledException handler working for a Windows Service I'm writing in VB.NET. I've read the MSDN and tried various different placements of the AddHandler call, to no...
2
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS...
1
by: pack | last post by:
What're the meaning of "App domain" and "Current Domain" in appdomain.CurrentDomain.UnhandledException?
7
by: Spam Catcher | last post by:
Hi all, When I'm debugging my application in VS.NET 2005, the debugger intercepts all unhandled exceptions and does not break into ApplicationEvents.UnhandledException. How do I debug...
1
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, is it possible use AppDomain.Currentdomain. UnhandledException event en ASP.NET 2.0 ?? I have this code: protected override void OnInit(EventArgs e) { base.OnInit(e);
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.