470,631 Members | 1,713 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

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 1654
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Frank | last post: by
5 posts views Thread by Lucvdv | last post: by
5 posts views Thread by Simon Tamman {Uchiha Jax} | last post: by
3 posts views Thread by NickP | last post: by
2 posts views Thread by Bob | last post: by
6 posts views Thread by Viktar Zhardzetski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.