elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.27k stars 1.15k forks source link

[BUG]Cannot break a Flowchart in While #5823

Open iio888 opened 2 months ago

iio888 commented 2 months ago

Description

When a While’s Body is a flowchart , and there is a Break as a Then activity in a If, I found that I cannot break the While.

While w = new() {
    Body = new Flowchart() {
        Activities = {
         new WriteLine(“Do1”),
            new If(e => true) {
            Then = new Break(),
            },
        new WriteLine(“Do2”),
        }
       // Connected like Sequence
    }
};

Also, without the while , I cannot terminate the flowchart when the Then activity is End.

Flowchart chart = new() {
    Activities = {
        new WriteLine(“Do1”),
        new If(e => true) {
            Then = new End(),
        },
        new WriteLine(“Do2”)
    }
    // Connected like Sequence
}

Expected Behavior

Actual Behavior

Environment

Troubleshooting Attempts

It seems Flowchart doesn’t receive BreakSignal and judge whether IsBreak in OnChildCompletedAsync method of Flowchart. I have tried to substitute Flowchart with Sequence and it goes well.

iio888 commented 2 months ago

Is there any quick fix to resolve it?