473,387 Members | 1,569 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,387 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 7492
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.