locked
Prevent workflow instance from aborting when exception is raised in a TransactedReceiveScope RRS feed

  • Question

  • We have a sequential WCF workflow service (bidirectional, XAML, IIS-hosted) that performs several calls to other WCF services (that are not necessarily workflows) that execute transactional operations within a TransactedReceiveScope. We've been struggling with an issue that we think is somehow related to the fact that you cannot easily set the value of the AbortInstanceOnTransactionFailure flag like you do with TransactionScope activity.

    Whenever an exception is raised in one of the lower layers of our architecture (SOA architecture; we've made a custom implementation of the IErrorHandler interface in order to pass exceptions as they occur across WCF services and have managed to catch them in client applications using regular, C#-style try/catch blocks rather than use fault contracts) and properly catched within either of the custom (derived from CodeActivity<T> activity) transactional activities that comprise the entire transactional scope, the ambient transaction is aborted, hence making the workflow instance abort as well.

    What we want to do is bubble up the exception to the client layer (an API layer) and let our marshal do the handling as with the lower layers (deserialize the fault detail and convert it to an exception object), instead of receive a generic "The workflow has been aborted." error message without any further info on it.

    Has anyone faced a similar issue or has any idea on what can be done to prevent the workflow from being aborted whenever a transaction is aborted?

    We've been looking everywhere for answers and this thread is the only one that comes close to our issue:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/d068c57e-11bf-4e0c-9544-75ede23c329e/how-do-we-make-the-original-exception-bubble-to-the-client-of-a-wcf-workflow-containing-a

    Details on the implementation of the exception marshaling:

    https://web.archive.org/web/20081118071929/http://www.olegsych.com/2008/07/simplifying-wcf-using-exceptions-as-faults/

    It's worth mentioning that the same behavior applies for WCF workflow services using a declarative approach (via *.config files) so that prior implementing transactional activity in our workflows this was working as expected.

    Thanks in advance.

    PS: This exact same question has been asked in Stack Overflow, here: http://stackoverflow.com/questions/40030220/prevent-workflow-instance-from-aborting-when-exception-is-raised-in-a-transacted

    Tuesday, October 18, 2016 5:15 PM

All replies

  • Hi Andrés Durán Hewitt,

    According to previous discussion, because the workflow is aborting due to the exception, the transaction is aborted - unfortunately this is hiding the exception message you wanted to return.

    It seems that we don't have feasible way to do that.

    Please let me know if you need any help.

    Regards,

    Angie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, October 24, 2016 9:12 AM