|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unhandled handled exception in Catch lineThis 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 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! Show quoteHide quote "Nick" <nospam@nospam.com> wrote in message news:u0LVNolJGHA.916@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 > 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 Show quoteHide quote "Nick" <nospam@nospam.com> wrote in message news:OeRFptlJGHA.2212@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" <nospam@nospam.com> wrote in message > news:u0LVNolJGHA.916@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 >> > > Hi Nick,
> ThreadAbortException is a "special" exception; unless the That's very strange, I must say that I have never experienced this > System.Thread.ResetAbort method is called the exception will be > automatically rethrown. 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. Show quoteHide quote "Nick Hall" <nickh@aslan.nospam.co.uk> wrote in message news:elzyKSmJGHA.3504@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" <nospam@nospam.com> wrote in message > news:OeRFptlJGHA.2212@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" <nospam@nospam.com> wrote in message >> news:u0LVNolJGHA.916@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 >>> >> >> > > |
|||||||||||||||||||||||