472,789 Members | 1,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Hide JIT Debug Error

I'm trying to create an all encompassing error handler to handle all
Unhandled Exceptions. I have added an event handler to
AppDomain.CurrentDomain.UnhandledException and everything works fine when
debugging. When I try to run the app outside of the IDE I get the JIT Debug
message and my app never gets to the UnhandledException event. What am I
doing wrong??? Thanks in advance.

Sample code from a Windows App:

[Windows Stuff]

....
....
....

[STAThread]
static void Main()
{
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(CurrentDomain_Unhan dledException);
Application.Run(new Form1());
}

private static void CurrentDomain_UnhandledException(object sender,
UnhandledExceptionEventArgs e)
{
MessageBox.Show("Error!!!");
Application.Exit();
}

private void button1_Click(object sender, System.EventArgs e)
{
throw new Exception();
}

Jul 21 '05 #1
4 2545
Hi jcarter,

Thanks for your post.

In .Net, the Winform has the build-in unhandled exception handler, which is
placed in an internal Application.OnThreadException method.(If you like,
you can use Reflector to view the implementation of this method). So we
should not use AppDomain.UnhandledException in Winform.

To override the build-in unhandled exception handling in Winform, we should
register Application.ThreadException event, then we can catch the unhandled
exception without any problem.

There is a great article writen by Jason Clark focusing on unhandled
exception handling in .Net, please refer to:
"Unexpected Errors in Managed Applications"
http://msdn.microsoft.com/msdnmag/issues/04/06/NET/

There is also some code snippet and a sample project do the demonstration
in this article.
================================================== =======
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Hi jcarter,

Does my reply make sense to you? Is your problem resolved? If you still
have anything unclear, please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Jeffery,

Sorry, I've been busy and forgot to reply. Yes. I did get a chance to try
this out and it worked great. Thanks for your help.

:// Jake Carter

""Jeffrey Tan[MSFT]"" wrote:
Hi jcarter,

Does my reply make sense to you? Is your problem resolved? If you still
have anything unclear, please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4
You are welcome :-)

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5

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

Similar topics

2
by: John Black | last post by:
Hi, I am using assert() to hide some debug dump out like this, int dump(){ ... some printf... return 0; } then in my main code, I do this, assert(dump() == 0);
15
by: Enzo | last post by:
Hi Ng, It's possible to protect the source code of a js file? With PHP? Thanks in advance! Enzo
2
by: James | last post by:
Hi I have set up a subform in datasheet mode containing a second subform also in datasheet mode in order to be able to open it as a subdatasheet. In my application I make the first subform...
10
by: Ray Z | last post by:
hi, there I build a Class Library, I write a class A to implement interface IA. The problem is when I give the dll file to others, thet can get all information about not only IA, but also A. They...
4
by: Stephen Miller | last post by:
Hi, I am running v1.1.4322 on Win2K server and unable to debug a ASP.Net application running locally, using a full URL (ie www.mysite.com). When I hit F5, I get the following error message: ...
4
by: Jake | last post by:
I'm trying to create an all encompassing error handler to handle all Unhandled Exceptions. I have added an event handler to AppDomain.CurrentDomain.UnhandledException and everything works fine when...
2
by: Badass Scotsman | last post by:
Hello, I have two files, default.aspx and default.aspx.cs. On my ASPX file I have the following code: <asp:panel ID="MyPanel" runat="server"> Content Here </asp:panel> And I want to...
6
by: Andrew Rowley | last post by:
I am having trouble getting debug and release builds to work properly with project references using C++ .NET and Visual Studio 2003. I created a test solution, with a basic Windows form C++...
3
by: rorni | last post by:
Hi, I'm porting code from Windows to HP-UX 11, compiling with g++. I'm getting a compilation error on the system's debug.h include file, which is included very indirectly through a series of...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.