elsa-workflows / elsa-core

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

[BUG] Programmatic nested Flowcharts null in designer #5428

Open MaxBrooks114 opened 3 months ago

MaxBrooks114 commented 3 months ago

Description

I created a programmatic flowchart workflow where there are some activities which are then followed by an If statement. When viewing that workflow in the designer if I try to see the body of the if activity get a null reference error. This also happens with ForEach statements as well.

Steps to Reproduce

create a flowchart programmatic workflow with an if activity and have the "then" attribute be a continuation of the workflow instead of just a writeline or single activity, namely it should have activties after it e.g. Event => SetVariable => If (then => ForEach( => new FlowChart( any activities)))

glime-ai[bot] commented 3 months ago

To address the issue you're experiencing with the null reference error when viewing the body of an If activity in the designer, it's important to ensure that the If activity is properly configured with its Then and Else branches. If the Then branch contains a ForEach activity that leads to a new FlowChart, it's crucial that all activities within that FlowChart are correctly instantiated and connected.

Based on the context provided, it seems like there might be a problem with how the activities are being instantiated or connected within the Then branch of the If activity. Here are some steps you can take to troubleshoot the issue:

  1. Verify that all activities within the Then branch, including those within the ForEach and subsequent FlowChart, are properly instantiated and have all required properties set.
  2. Ensure that the connections between activities are correctly defined.
  3. Check for any missing or null references within the Then branch that could be causing the null reference error.
  4. Look for any discrepancies between the programmatic workflow definition and the designer's expectations. The designer might not be able to interpret certain programmatic constructs if they are not represented in a way that the designer can understand.

If you continue to experience issues, consider consulting the Elsa documentation for more detailed guidance on defining workflows programmatically and ensuring compatibility with the designer. Additionally, you may want to reach out to the Elsa community or support channels for assistance with specific issues related to the designer's interpretation of programmatic workflows.

For further reference, you can review the Elsa documentation on programmatic workflows and designer workflows, as well as the core concepts of activities and flowcharts:

If the issue persists and seems to be a bug, you may want to report it on the Elsa GitHub issues page, providing a detailed description and steps to reproduce the problem:

This comment was generated by Glime.

MaxBrooks114 commented 3 months ago

I'm wondering if it is how the workflow appears in the studio. I have a value and conditions set for the workflow's setvariable and if condition, but when looking at it in the studio it is blank/ null as well as when i export it as JSON.