Describe the Bug
The official documentation for WorkflowControlActions.ForEach
at https://learn.microsoft.com/en-us/azure/logic-apps/standard-sdk/workflow-control-actions-class-definition
shows this example:
var forEach = WorkflowActions.BuiltIn.Control.ForEach(
items: () => JArray.Parse("[\"one\",\"two\"]"),
actions: (item) => WorkflowActions.BuiltIn
.Compose(inputs: () => $"Item: {item}")
.WithName("ProcessItem")
).WithName("LoopItems");
This compiles but throws at runtime:
System.NotImplementedException:
Can't convert call to method
Newtonsoft.Json.Linq.JArray Parse(System.String): Parse("[]")
The expression tree converter cannot handle method calls
(JArray.Parse(...)) inside lambda expressions. Similarly,
new JArray() also fails with a different
NotImplementedException from ComplexObjectConverter.Visit.
Plan Type
Standard
Steps to Reproduce the Bug or Issue
To Reproduce
- Create a codeful workflow project per the SDK docs
- Use the exact ForEach example from the documentation
- Run the project
- Observe the runtime exception
Expected behavior
The documented example should work at runtime. If JArray.Parse
is not supported in expression trees, the documentation should
show the correct pattern (e.g., referencing a previous action's
.Body output or using a supported expression form).
Actual behavior
NotImplementedException thrown by
LogicExpressionConverter.Visit(MethodCallExpression).
Workaround
Use a string literal cast to JToken:
var forEach = WorkflowActions.BuiltIn.Control.ForEach(
items: () => (JToken)"placeholder",
actions: (item) => ...);
This generates "Foreach": "placeholder" in the JSON. For real
usage, reference a typed action's output (e.g., http.Body).
Workflow JSON
Screenshots or Videos
No response
Additional context
Environment
- Microsoft.Azure.Workflows.Sdk: 1.0.0-preview.1
- .NET: net8.0
- OS: Windows 11
- Docs page: workflow-control-actions-class-definition
Describe the Bug
The official documentation for
WorkflowControlActions.ForEachat https://learn.microsoft.com/en-us/azure/logic-apps/standard-sdk/workflow-control-actions-class-definition
shows this example:
This compiles but throws at runtime:
The expression tree converter cannot handle method calls
(
JArray.Parse(...)) inside lambda expressions. Similarly,new JArray()also fails with a differentNotImplementedExceptionfromComplexObjectConverter.Visit.Plan Type
Standard
Steps to Reproduce the Bug or Issue
To Reproduce
Expected behavior
The documented example should work at runtime. If
JArray.Parseis not supported in expression trees, the documentation should
show the correct pattern (e.g., referencing a previous action's
.Bodyoutput or using a supported expression form).Actual behavior
NotImplementedExceptionthrown byLogicExpressionConverter.Visit(MethodCallExpression).Workaround
Use a string literal cast to JToken:
This generates
"Foreach": "placeholder"in the JSON. For realusage, reference a typed action's output (e.g.,
http.Body).Workflow JSON
Screenshots or Videos
No response
Additional context
Environment