在更短的时间内更轻松地开发ASP.NET应用程序: http ://www.atozed.com/IntraWeb/ 谢谢,但不会工作。我不能使用一个事件,我需要从内联代码确定。 我也不能设置一个标志,因为它的线程(可以找到某种方式跟踪或许跟踪)但是更大的问题是我怀疑它就像Delphi的异常处理程序一样,它发生在所有代码发布到外层之后,所以它会发生在我的代码之后执行。 - Chad Z. Hower(又名Kudzu) - http://www.hower.org/Kudzu/ 编程是一种反击的艺术形式 更容易开发ASP.NET应用程序在更短的时间内: http://www.atozed.com/IntraWeb/ Its a bit tough to explain why I need this, so I wont. Consider it academic for now.I would like to detect if an exception is currently being thrown, but I cannot use a try statement. Thisis not what I want to do, but this will demonstrate what I want to do:trythrow exceptionfinally {Foo();}Foo() {if (An Exception is currently being thrown/handled) {Do sometihng}}I realize in the above case I coudl use catch, pass it as an argument, and re throw. But for the actaulsituation Im looking at, I cannot do that and will not have access to a catch.Ive looked at StackTrace, but it does not seem to hold this information either unless Ive missed it onquick glance. In Delphi there is a "global" that holds the current exception for the current thread. Isthere anything like this anywhere in .NET, or any way to obtain it?--Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/"Programming is an art form that fights back"Make your ASP.NET applications run faster http://www.atozed.com/IntraWeb/ 解决方案Thanks, but wont work. I cant use an event, I need to determine from inline code.I cant set a flag either, because its threaded (Which could find some way to track maybe) but thebigger issue is that I suspect its like Delphi''s exception handler, it happens AFTER all the code hasmade it out to the outer levels so it would happen after my code executed.--Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/"Programming is an art form that fights back"Develop ASP.NET applications easier and in less time: http://www.atozed.com/IntraWeb/ Thanks, but wont work. I cant use an event, I need to determine from inline code. I cant set a flag either, because its threaded (Which could find some way to track maybe) but the bigger issue is that I suspect its like Delphi''s exception handler, it happens AFTER all the code has made it out to the outer levels so it would happen after my code executed. -- Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/ "Programming is an art form that fights back" Develop ASP.NET applications easier and in less time: http://www.atozed.com/IntraWeb/ 这篇关于目前的例外情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-01 12:27