none
How to handle ThreadAbortException in WF RRS feed

  • 问题

  • Hi all, 

    i have a wf service application. at the top of the wf, we persisted it into db. then execute some logic. in the logic, we will schedule a customer code activity named "ImportProcess". the code in "ImportProcess“ looks like below.

    try{

    ......

    //invoke other method and ThreadAbortException exception be throw out from here

    var result = new service().Invoke();

    .....

    } catch (System.Threading.ThreadAbortException ex)

    {

     System.Threading.Thread.ResetAbort();

    }

    i hope to catch the ThreadAbortException  exception and process it. not let the workflow run-time got the type exception. because if the workflow run-time got the exception, then the workflow will be abort and will resume it from the latest persisted point. so you can see the workflow will retry after the threadabortexception be throw out. and not stop, except you to delete the instance from persisted db.

    MSDN document say that we can cancel it by use Thread.ResetAbort(). i have try but failed.

    http://msdn.microsoft.com/zh-cn/library/system.threading.threadabortexception(v=vs.110).aspx

    does anybody have any idea about how to prevent the exception be catch by workflow run-time?

    Thanks

    Jiao

    2014年5月8日 9:17

全部回复

  • > var result = new service().Invoke();

    Does the ThreadAbortException  exception happen  in another thread?

    2014年5月9日 2:09
  • i'm not sure whether it is happen in another thread. just know, the exception from Invoke() method.
    2014年5月11日 7:51
  • i'm not sure whether it is happen in another thread. just know, the exception from Invoke() method.

    Is it WCF Service?

    If it happens in another thread or asynchronous process,I think you should reset it in Invoke method.

    2014年5月12日 1:43