zoukankan      html  css  js  c++  java
  • A wordaround way for issue: CompositeActivity cannot transition to 'Closed' status when there are active child activity.

     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:

      

    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.

  • 相关阅读:
    密码学与安全技术
    分布式系统核心问题
    虚拟机性能监控与故障处理工具
    垃圾收集器与内存分配策略
    Channel
    Buffer
    Reactor
    I/O简介
    HashMap
    装饰者模式
  • 原文地址:https://www.cnblogs.com/lxg226/p/1823123.html
Copyright © 2011-2022 走看看