473,804 Members | 3,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unhandled Exception in Form Load in EXE but not in IDE

I have a weird error trapping problem. When running the IDE everything works
fine but not when running in an EXE I get the Unhandled Exception Error
message box intead of the one in my Try....Catch Block.

To see this create a simple application with two forms. Form 1 should have
one button. The code is follows. Run this in the IDE and observe the error
and then compare that behavior to what happens when you run the built EXE.

Has anyone seen this?

Thanks,

Mark

=============== =============== =============== ==

Public Class Form1

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Dim f As New Form2
Try

f.Show()

Catch ex As Exception

MessageBox.Show (ex.Message)
f.Dispose()

End Try
End Sub
End Class
Public Class Form2

Private Sub Form2_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Throw New ApplicationExce ption("error thrown in form2 load")

End Sub

End Class
Aug 7 '06
15 2344
Hi Mark,

Thank you for sharing your findings with the community.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 18 '06 #11
Would you think this is a bug in the EXE or in the IDE. It would be best if
the two would work the same.

Mark

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:uF******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Mark,

Thank you for sharing your findings with the community.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 23 '06 #12
Hello Mark,

Walter is taking leave this week. Is it OK for us to work with you next
week for it if this is not urgent?

Based on my experience, if we can get a repro sample, we can definitely
forward that to our product team for further analysis. This may need some
more time. But please rest assured that we will do our best to work with
you.

Surely you can also talk to our development directly and report it. Please
use the following web link:
http://connect.microsoft.com/site/si...spx?SiteID=210

If you feel there is any we can do, please feel free to reply here and we
will follow up.

Thanks very much.

Sincerely,
Yanhong Huang
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 25 '06 #13
Hi Mark,

Sorry for late reply. I will do more research on your question and get back
to you as soon as possible. Thank you for your patience and understanding.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 30 '06 #14
Hi Mark,

If you set the "Debug Info" from "pdbonly" to "none", a required
DebuggableAttri bute is not emitted in the result assembly. Internally the
framework checks this attribute to determine whether or not to use the
DebuggableCallb ack instead of the normal Callback.

By default, a Release configuration has setting "pdbonly", it will only
emit some attribute in the assembly; you don't need to release the .pdb
file.

So the answer to your last question about whether or not it's a bug in IDE
is: it's not a bug in IDE. As I wrote in my first reply, this should still
be considered as by design.

Back to initial requirement, if your desire is to report the exception with
your own dialog, I think customizing the built-in exception dialog is the
way to go. You also don't need to put many try-catch block in your code.
Remember, this issue only applies to the event triggered by NativeWindow
(WndProc callback), normal program exceptions are not effected.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 31 '06 #15
Thanks. As I said, I believe this is a bug as errors that are trapped in the
IDE by the normal Try-Catch syntax are not caught in an EXE unless the JIT
switch is set and a PDB is generated. The product should behave consistently
one way or the other. If this is by design then it is a silly design but I
suspect that this was never thought through carefully so is not by design.

It does appear that a custom error handler is the only way to trap these
sort of errors. Hopefully this will be fixed/redesigned in a later release.

I think you can close this one out as there does not seem to be any Hotfix
and there is a work around.

Thanks again,

Mark
"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:HK******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Mark,

If you set the "Debug Info" from "pdbonly" to "none", a required
DebuggableAttri bute is not emitted in the result assembly. Internally the
framework checks this attribute to determine whether or not to use the
DebuggableCallb ack instead of the normal Callback.

By default, a Release configuration has setting "pdbonly", it will only
emit some attribute in the assembly; you don't need to release the .pdb
file.

So the answer to your last question about whether or not it's a bug in IDE
is: it's not a bug in IDE. As I wrote in my first reply, this should still
be considered as by design.

Back to initial requirement, if your desire is to report the exception
with
your own dialog, I think customizing the built-in exception dialog is the
way to go. You also don't need to put many try-catch block in your code.
Remember, this issue only applies to the event triggered by NativeWindow
(WndProc callback), normal program exceptions are not effected.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 4 '06 #16

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

Similar topics

1
536
by: Rafael | last post by:
Hi, I hope I can find some help for this problem IDE: Visual Studio.NET 2003 Developer Editio Language: C# Problem: "An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll. Additional information: Object reference not set to an instance of an object. Visual Studio's IDE is not allowing me to develop projects in C#... I've trying to create a simple Windows Forms project using Visual Studio.NET...
7
2717
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote server returned an error: (500) Internal Server Error." I found a post that suggested to catch the WebException to retrieve the actual HttpWebResponse object for more information. The response returned is shown below. At first I thought this was a...
1
2106
by: mike | last post by:
My program is crashing, but it doesn't crash on a single line of code. Below is what the output tab displays. I have no idea where to start inorder to debug this problem. Is there any suggesstions on how to start debuging the problem 'DefaultDomain': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded 'StoredProcedure': Loaded 'N:\Dev\Programs\MNTEST3.net\Template.NET\bin\StoredProcedure.exe', No symbols...
5
5756
by: Lucvdv | last post by:
Can someone explain why this code pops up a messagebox saying the ThreadAbortException wasn't handled? The first exception is reported only in the debug pane, as expected. The second (caused by thread.Abort()) is reported twice: once in the debug window, and once through the message box. Is it because the thread was sleeping when the exception occurred?
5
4546
by: Sam Loveridge | last post by:
Hi All. I'm hoping someone can point me in the direction of a solution to unhandled exceptions in MDI child forms causing the application to crash. I've found various articles describing a method using Application.Run(new MyMainParentForm) to place in the application's Sub Main to allow catching of unhandled exceptions in the application. The problem I'm facing is that I want to be able to trap unhandled exceptions at the MDI child...
0
1993
by: Colmeister | last post by:
I recently read Jason Clark's excellent article on Unhandled Exceptions (http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx) and have attempted to incorporate the features he talks about in a new application I'm writing. However, when I try to use ThreadStart to do some work in a separate thread from my GUI, the methods Jason described don't seem to catch the exception. Take the following source code: Public Class...
5
3405
by: Simon Tamman {Uchiha Jax} | last post by:
Now this is bugging me. I just released software for a client and they have reported an unhandled stack overflow exception. My first concern is that the entirity of the UI and any threaded operations are all within Try Catches to help me locate the problem and the origination of any problem by specifiying an error code in the "Catch" section. So theoretically this shouldn't have been possible (at which point we all say "yeah,...
6
1671
by: Viktar Zhardzetski | last post by:
Hi everybody, let me start with a simple sample to replicate the problem: 1. Create a new Windows Application C# project with 2 forms - MainForm and FaultyForm; 2. In the faulty form override the OnLoad method to throw an exception: public partial class FaultyForm : Form ...
5
3213
lotus18
by: lotus18 | last post by:
WaAh! My form was working fine earlier but later it displays Invalid Operation Exception was unhandled. I don't know what's wrong with my form every time I load it.I checked its codes but I find what's wrong with it. If I'm going to remove Transaction.Courses.Show(False, txtSearch.Text) at line #2 of frmCourses it works fine. Of course I cannot filter the records : ( This is my sample codes clsCourses
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7621
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.