Orleans.Activities
Orleans.Activities copied to clipboard
CancelWorkflow should complete WF in Canceled and not in Closed state
When the workflow cancels itself due to an unhandled exception in a ReceiveRequestSendResponseScope, the completion state of the workflow is Closed nod Canceled.
If we let the exception to buble up, and a real OnUnhandledException event occurs, that schedules workflow cancellation after the Idle event, the completion state will be correct.
I suppose, there is missing a context.MarkCanceled(); statement somewhere in this activity that prevents the default cancellation of the root activity to finally make Canceled it's state instead of Closed. The TaskAsyncNativeActivity turns off default Cancellation, if cancellation finally happens, MarkCanceled should be called somewhere.
See: http://blogs.msdn.com/b/carlos/archive/2013/02/06/wf4-workflow-foundation-4-understanding-cancellation.aspx