A wordaround way for issue: CompositeActivity cannot transition to 'Closed' status when there are ac...

 BTW:不知道怎么上传zip文件,谁能指教一下?

Recently I add compensation feature for workflow process in our project, however I get a weird InvalidOperationException Exception:

‘CompositeActivity cannot transition to 'Closed' status when there are active child activity’. Btw internal call stack is

  at System.Workflow.ComponentModel.Activity.MarkClosed()

   at System.Workflow.ComponentModel.Activity.MarkFaulted()

   at System.Workflow.ComponentModel.ActivityExecutionContext.CloseActivity()

   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)

   at System.Workflow.Runtime.Scheduler.Run()

 

I take a long time to make a dig, and finally find out a workaround way to avoid the issue.

 

Repro scenario for this issue at attached ComposateIssue project: (My Environment: VS2008, and WF3.5/Workflow Service using ReceiveActivity)

The workflow is as follows:

  2010091011323184.png2010091011324082.png

 

The workflow waits the GetData event by ReceiveActivity; activityTestCompensate1 that is an instance of ActivityTestCompensate custom activity including ComponsatableSequenceActivity named cpsActivity1, for figure 1 you can see normal process of it, and for figure 2 you can see Fault handler process of it, comensateActivity1 is an instance of CompensateActivity.

The issue for that exception occurs when meeting both of two conditions:

  1. activityTestCompensate1 is placed inside ReceiveActivity.
  2. compensateActivity1 set TargetActivityName property to ActivityTestCompensate rather than cpsActivity1.

 

 Resolution:

That is so simple, if only we break any of two conditions above, that exception will disappear.

 

转载于:https://www.cnblogs.com/lxg226/archive/2010/09/10/1823123.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值