473,386 Members | 1,706 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,386 software developers and data experts.

Unhandled handled exception in Catch line

Hi there,

This probably wont make much sense but I'm getting an unhandled
exception being thrown in the following line...

Try
While True
Redraw control as necessary
End While
Catch ex as Exception <<< Here!
End Try

This code is being run in a seperate thread, hence the eternal loop,
stopping of the thread is performed by aborting it, which has always worked
for me in the past. This exception is actually bubbling up to the
application_unhandledexception event pointing to the Catch line. Which
Doesn't really make sense does it??

I've tried moving the drawing code around several times but the whole
concept of an unhandled exception occuring in the Catch line confuses me a
little. Does anyone have any idea why this would happen?

--
Nick

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice
Jan 31 '06 #1
3 1787
Sorry I forgot to mention what the exception actually is!

ThreadAbortException - Thread was being aborted.

Which is the whole reason the catch block is there, to catch that one
exception!

"Nick" <no****@nospam.com> wrote in message
news:u0*************@TK2MSFTNGP10.phx.gbl...
Hi there,

This probably wont make much sense but I'm getting an unhandled
exception being thrown in the following line...

Try
While True
Redraw control as necessary
End While
Catch ex as Exception <<< Here!
End Try

This code is being run in a seperate thread, hence the eternal loop,
stopping of the thread is performed by aborting it, which has always
worked for me in the past. This exception is actually bubbling up to the
application_unhandledexception event pointing to the Catch line. Which
Doesn't really make sense does it??

I've tried moving the drawing code around several times but the whole
concept of an unhandled exception occuring in the Catch line confuses me a
little. Does anyone have any idea why this would happen?

--
Nick

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice

Jan 31 '06 #2
Hi Nick,

ThreadAbortException is a "special" exception; unless the
System.Thread.ResetAbort method is called the exception will be
automatically rethrown.

Generally speaking it is not a good idea to have "generic" catch block of
this style as it can cause underlying problems to be hidden. Its better to
deal with the exception you expect and let anything else fall through.

Hope this helps,

Nick Hall
"Nick" <no****@nospam.com> wrote in message
news:Oe**************@TK2MSFTNGP15.phx.gbl...
Sorry I forgot to mention what the exception actually is!

ThreadAbortException - Thread was being aborted.

Which is the whole reason the catch block is there, to catch that one
exception!

"Nick" <no****@nospam.com> wrote in message
news:u0*************@TK2MSFTNGP10.phx.gbl...
Hi there,

This probably wont make much sense but I'm getting an unhandled
exception being thrown in the following line...

Try
While True
Redraw control as necessary
End While
Catch ex as Exception <<< Here!
End Try

This code is being run in a seperate thread, hence the eternal loop,
stopping of the thread is performed by aborting it, which has always
worked for me in the past. This exception is actually bubbling up to the
application_unhandledexception event pointing to the Catch line. Which
Doesn't really make sense does it??

I've tried moving the drawing code around several times but the whole
concept of an unhandled exception occuring in the Catch line confuses me
a little. Does anyone have any idea why this would happen?

--
Nick

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice


Jan 31 '06 #3
Hi Nick,
ThreadAbortException is a "special" exception; unless the
System.Thread.ResetAbort method is called the exception will be
automatically rethrown.
That's very strange, I must say that I have never experienced this
before and I have quite a few controls using threads in this mannor. I just
tried a test application and put a resetabort call into the
threadabortexception handler and it gets rid of the problem, it's rather
strange how I havent come across this before?!

Oh the joys! Thank you so much for your help.

Nick.

"Nick Hall" <ni***@aslan.nospam.co.uk> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl... Hi Nick,

Generally speaking it is not a good idea to have "generic" catch block of
this style as it can cause underlying problems to be hidden. Its better
to deal with the exception you expect and let anything else fall through.

Hope this helps,

Nick Hall
"Nick" <no****@nospam.com> wrote in message
news:Oe**************@TK2MSFTNGP15.phx.gbl...
Sorry I forgot to mention what the exception actually is!

ThreadAbortException - Thread was being aborted.

Which is the whole reason the catch block is there, to catch that one
exception!

"Nick" <no****@nospam.com> wrote in message
news:u0*************@TK2MSFTNGP10.phx.gbl...
Hi there,

This probably wont make much sense but I'm getting an unhandled
exception being thrown in the following line...

Try
While True
Redraw control as necessary
End While
Catch ex as Exception <<< Here!
End Try

This code is being run in a seperate thread, hence the eternal loop,
stopping of the thread is performed by aborting it, which has always
worked for me in the past. This exception is actually bubbling up to
the application_unhandledexception event pointing to the Catch line.
Which Doesn't really make sense does it??

I've tried moving the drawing code around several times but the whole
concept of an unhandled exception occuring in the Catch line confuses me
a little. Does anyone have any idea why this would happen?

--
Nick

---------------------------------------------------------------
Please do not reply directly to me, but the entire newsgroup.
Any views expressed above are my own
Without predjudice



Jan 31 '06 #4

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

Similar topics

4
by: Frank | last post by:
Hi, I made a handler for unhandled errors. But before that is executed, VB.NET gives me the standard error window. In VB6 there was a setting (errortrapping) about handling errors in the design...
5
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...
5
by: Samuel R. Neff | last post by:
When you have an unhandled exception in vb.net how do you view the exception information in the debugger? In C# the debugger creates a local variable that points to the exception and you can...
5
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...
3
by: NickP | last post by:
Hi there, Im experiencing an unhandled exception that seems to be impossible for me to catch. I am launching an assembly of mine from within another assembly using the Process object. Once the...
2
by: Bob | last post by:
I MUST be able to trap unhandled exceptions, bring the thread to a routine that then closes the thread on which the execption occurred without closing or affecting the other threads. Think of an...
15
by: Mark Lewis | last post by:
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...
6
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...
1
by: bg_ie | last post by:
Hi, I have the following Program.cs - namespace TestFrameworkApplication { static class Program { /// <summary> /// The main entry point for the application.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.