473,657 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Vanishing Exceptions

My unhandled exceptions seem to just vanish. If I put the line:
int x = int.Parse("XXX" );
in (which generates an exception, obviously) then the code that's
executing just vanishes, leaving me back at the form (which carries on
working). If I deliberately catch an error, I catch it just fine.

Stepping through it line by line, it runs to the exception generating
line, and then just doesn't execute anything beyond that line.

I've checked my Exceptions dialog, and CLR Exceptions are definitely
set to Break Into Debugger if Not Handled.

Any idea why unhandled errors might not do anything at all?
Andy D

Nov 17 '05 #1
7 1577
I have seen cases (however I am never able to adequately reproduce them on
smaller scale) where when an exception occurs in a sub thread of my main app,
the thread just terminates. No CLR exception notice, just a note that the
thread has exited.

Where is the exception causing code occurring? Is it in your main thread or
something lower?

Brendan
"Andrew Ducker" wrote:
My unhandled exceptions seem to just vanish. If I put the line:
int x = int.Parse("XXX" );
in (which generates an exception, obviously) then the code that's
executing just vanishes, leaving me back at the form (which carries on
working). If I deliberately catch an error, I catch it just fine.

Stepping through it line by line, it runs to the exception generating
line, and then just doesn't execute anything beyond that line.

I've checked my Exceptions dialog, and CLR Exceptions are definitely
set to Break Into Debugger if Not Handled.

Any idea why unhandled errors might not do anything at all?
Andy D

Nov 17 '05 #2
Hi,

There are couple of things to check, first are you doing that in a thread?
if so the UI will not receive it, you use AppDomain.Unhan dledException or
Application.Thr eadException

Also, check if you have your solution in debug mode, also check the project
properties to make sure you have optimization disabled.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Andrew Ducker" <an****@ducker. org.uk> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
My unhandled exceptions seem to just vanish. If I put the line:
int x = int.Parse("XXX" );
in (which generates an exception, obviously) then the code that's
executing just vanishes, leaving me back at the form (which carries on
working). If I deliberately catch an error, I catch it just fine.

Stepping through it line by line, it runs to the exception generating
line, and then just doesn't execute anything beyond that line.

I've checked my Exceptions dialog, and CLR Exceptions are definitely
set to Break Into Debugger if Not Handled.

Any idea why unhandled errors might not do anything at all?
Andy D

Nov 17 '05 #3
The calling regimen for WinForms works differently when running under
the debugger versus running independently. When _not_ running under the
debugger, in many instances your methods are called directly by Windows
rather than from where you think they should be called.

This can result in some strange run-time behaviour where exceptions are
concerned: some exceptions that are successfully caught by a
try...catch under the debugger take your app down outside the debugger.
If you look at the call stack you won't see the method that contains
the try...catch anywhere on the stack. Instead, you'll see your failing
code being called directly by Windows.

Another case is some exceptions that are trapped by a try...catch when
running under the debugger are caught instead by some generic
exception-handling code in a standard Windows form when running outside
the debugger. The form is designed to simply swallow exceptions and
keep running, which it does. (I use the PrintPreviewDia log, which does
this.)

Someone here once described in detail exactly how this works, but I
can't find the thread right now.

Nov 17 '05 #4
If you are in a thread, you can use ThreadException or add try catch in your
thread and when an exception is caught, use Application.OnT hreadException( e)
to trasmit it to the main thread.

Is it whith drag/drop operations ? I already had the same problem in the
main thread with drag/drop operation. When you use DragOver or DragDrop
event, windows surround your code with try catch. And if one exception
occurs, it doesn't transmit it.

Hope it helps,
Ludovic Soeur.
"Andrew Ducker" <an****@ducker. org.uk> a écrit dans le message de
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
My unhandled exceptions seem to just vanish. If I put the line:
int x = int.Parse("XXX" );
in (which generates an exception, obviously) then the code that's
executing just vanishes, leaving me back at the form (which carries on
working). If I deliberately catch an error, I catch it just fine.

Stepping through it line by line, it runs to the exception generating
line, and then just doesn't execute anything beyond that line.

I've checked my Exceptions dialog, and CLR Exceptions are definitely
set to Break Into Debugger if Not Handled.

Any idea why unhandled errors might not do anything at all?
Andy D

Nov 17 '05 #5
It's in my main thread - but it only happens once the message pump
starts - i.e. if I call code as part of the initialisation of the main
code, exceptions are detected, but if the same code is called from a
button press then the exception just evaporates.

Andy D

Nov 17 '05 #6
I've had a look, but can't find details. As I replied above:

"It's in my main thread - but it only happens once the message pump
starts - i.e. if I call code as part of the initialisation of the main
code, exceptions are detected, but if the same code is called from a
button press then the exception just evaporates."

Which makes it, indeed, sound like it's vanishing into the cracks in
Windows. I might just trap AppDomain.Unhan dledException and see what
happens...

Cheers!

Andy D

Nov 17 '05 #7
Darnit - should have held off on posting. I added the following to the
start of my code:

AppDomain currentDomain = AppDomain.Curre ntDomain;
currentDomain.U nhandledExcepti on +=new
UnhandledExcept ionEventHandler (currentDomain_ UnhandledExcept ion);
Application.Thr eadException +=new
System.Threadin g.ThreadExcepti onEventHandler( Application_Thr eadException);

and then put some Messageboxes into those methods. Neither of them
ever get called. Something wierd is definitely going on.

Andy D

Nov 17 '05 #8

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

Similar topics

16
5279
by: David Turner | last post by:
Hi all I noticed something interesting while testing some RAII concepts ported from C++ in Python. I haven't managed to find any information about it on the web, hence this post. The problem is that when an exception is raised, the destruction of locals appears to be deferred to program exit. Am I missing something? Is this behaviour by design? If so, is there any reason for it? The only rationale I can think of is to speed up...
21
2220
by: dkcpub | last post by:
I'm very new to Python, but I couldn't find anything in the docs or faq about this. And I fished around in the IDLE menus but didn't see anything. Is there a tool that can determine all the exceptions that can be raised in a Python function, or in any of the functions it calls, etc.? /Dan
2
1316
by: Greg | last post by:
There is a repeating issue of controls vanishing from a form in the Dev environment which is starting to get annoying. What happens is that I will have a form open in the IDE. The form will have a variety of buttons on it. The form will be saved, then compiled and run. After it runs, one or more buttons have either vanished completely, or moved to a position of 0,0. If the control vanishes completely, it may still show up when...
0
1089
by: Michael | last post by:
After trying to load my java applet from <OBJECT> tag (rather than <APPLET> tag), it renders fine, except when you click between the DESIGN view then back to HTML view, the <PARAM NAME="ARCHIVE" VALUE="jars/myapp.jar"> line completely vanishes. Click to HTML view again, and the applet just does not load or work (as would be expected!). Re-add the vanishing line and all is well again.
2
1287
by: Linda | last post by:
Greetings, I am experiencing a problem similar to that mentioned in <a href="http://groups-beta.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/a4ca8746b3de09c2/3a24082f15010830?q=controls+vanishing&rnum=1#3a24082f15010830">this post</a>, which is too old for me to respond to. Does anyone have any additional information? I am using VB.Net 2003. The Solution has two projects: one is a library project, which...
1
2377
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I look for when evaluating someone's code is a try/catch block. While it isn't a perfect indicator, exception handling is one of the few things that quickly speak about the quality of code. Within seconds you might discover that the code author...
2
1412
by: mark4asp | last post by:
The first intem in a DropDownList is vanishing! My code to load a DropDownList is shown below. Yet when I load the page after a postback there is no zeroth item present. lstManager.Items.Clear(); lstManager.DataSource = _dsData.Tables.DefaultView; lstManager.DataValueField = "ManagerID"; lstManager.DataTextField = "Name";
0
6493
RedSon
by: RedSon | last post by:
Chapter 3: What are the most common Exceptions and what do they mean? As we saw in the last chapter, there isn't only the standard Exception, but you also get special exceptions like NullPointerException or ArrayIndexOutOfBoundsException. All of these extend the basic class Exception. In general, you can sort Exceptions into two groups: Checked and unchecked Exceptions. Checked Exceptions are checked by the compiler at compilation time. Most...
36
2483
by: TC | last post by:
I've used Access for many years. Several times, I've encountered a bug which I refer to as the "Vanishing Joins" bug. When it happens, joins vanish randomly from queries. More specifically, all joins vanish from at least one (seemingly random) query. I've always regarded the Vanishing Joins bug as a symptom of corruption. When it happens, I usually give my users advice on how to recover from corruption, and how to avoid it in the future....
0
8302
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
8820
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
8718
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
8601
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...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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

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.