|
|
|
I didn't know about that option. So I could indeed use that.
However, a ThreadAbortException is a special exception as it can NOT be caught. So the last line in this example will NEVER be executed! In that sense, this method is a special case which could be handled by your analysis tool as a throw statement, without any user configuration necessary. try { Response.Redirect("~/IncorrectRequestString.aspx"); } catch (ThreadAbortException) { // statements here will execute, but exception will ALWAYS be rethrown } // execution will NEVER reach this point! Actually, ThreadAbortException is re-throwed at every "catch (ThreadAbortException)" block until Thread.ResetAbort() is called
This logic is too specific and too complex to implement it in 3.0 > Actually, ThreadAbortException is re-throwed at every "catch (ThreadAbortException)" block
It is not quite correct. It is rethrown only if it is caused by Thread.Abort method, but not if it is "manually" thrown. using System; using System.Threading; class Program { static void Main() { ThreadAbortException e1 = null; try { Thread.CurrentThread.Abort(); } catch(ThreadAbortException e2) { e1 = e2; // This is just to obtain an instance of ThreadAbortException, it has not public ctors Thread.ResetAbort(); } try { throw e1; // Throw instance of ThreadAbortException "manually" } catch(ThreadAbortException) {} Console.WriteLine("It is not re-thrown!"); } } |
|||||||||||||||||||||||||||||||||||||||||||||||||
On the other hand, if it throws exception one could catch it and use module once again, so we may need a flag on terminating methods, saying if method just never returns or throws unconditionally.