How can I detect a ThreadAbortException in a finally block? (.NET)

前端 未结 7 2180
太阳男子
太阳男子 2020-12-15 12:08

I have some critical logic in a finally block (with an empty try block), because I want to guarantee that the code gets executed even if the thread is aborted. However, I\'d

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 12:31

    If calling Thread.Abort is bad design why does SQL Server call it on a thread that is running user code? Because this is exactly how a query cancel is handled and it causes nightmares.

提交回复
热议问题