OrchardCMS/OrchardCore · error · NotSupportedException
The syntax isn't supported for SetPropertyTask.
Error message
The syntax {Syntax} isn't supported for SetPropertyTask. What it means
SetPropertyTask computes the value to write into workflowContext.Properties by switching on the activity's Syntax. Only Liquid (LiquidValue) and JavaScript (Value) evaluation are implemented; any other WorkflowScriptSyntax value falls to the default arm and throws NotSupportedException, so the workflow property is never set.
Solutions
- Set Syntax to WorkflowScriptSyntax.Liquid and supply the value in the LiquidValue expression field.
- Or set Syntax to WorkflowScriptSyntax.JavaScript and provide the value in the Value field.
- Correct the stored workflow definition if it contains an obsolete syntax value.
- If a new syntax member exists in the enum, update/rebuild OrchardCore.Workflows so the switch arm is implemented.
Example fix
// before
var task = new SetPropertyTask(); // Syntax unset -> throws
// after
var task = new SetPropertyTask
{
Syntax = WorkflowScriptSyntax.JavaScript,
PropertyName = "LastRun",
Value = new JavaScriptExpression { Expression = "new Date().toISOString()" }
}; Defensive patterns
Strategy: validation
Validate before calling
// before executing the task
if (setPropertyTask.Syntax is not (WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript))
throw new InvalidOperationException($"SetPropertyTask requires Liquid or JavaScript syntax; got {setPropertyTask.Syntax}"); Type guard
static bool IsSupportedSyntax(WorkflowScriptSyntax s) => s is WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript;
Try / catch
try { result = await task.ExecuteAsync(workflowContext, activityContext); }
catch (NotSupportedException ex) { logger.LogError(ex, "SetPropertyTask evaluation failed for syntax {Syntax}", syntax); /* mark property unset */ } Prevention
- Set Syntax explicitly when constructing SetPropertyTask
- Pair PropertyName/Value/LiquidValue fields with the chosen syntax
- Validate imported workflow definitions
- Cover all WorkflowScriptSyntax members when extending the enum
When it happens
Trigger: Executing a SetPropertyTask whose Syntax property is not WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript — an unset/default enum value, an unrecognized syntax string deserialized from workflow JSON, or programmatic creation without assigning Syntax.
Common situations: Workflow definitions imported from other environments carrying stale syntax names; a newly added WorkflowScriptSyntax member unsupported by SetPropertyTask; missing Syntax assignment when constructing the activity in code or tests.
Related errors
- The syntax isn't supported for ForEachTask.
- The syntax isn't supported for ForLoopTask.
- The syntax isn't supported for IfElseTask.
- The syntax isn't supported for SetOutputTask.
- The syntax isn't supported for WhileLoopTask.
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/39f91fc9bb1ec266.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Workflows/Activities/SetPropertyTask.cs:61
set => SetProperty(value);
}
public WorkflowScriptSyntax Syntax
{
get => GetProperty(() => WorkflowScriptSyntax.JavaScript);
set => SetProperty(value);
}
public override IEnumerable<Outcome> GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
=> Outcome(S["Done"]);
public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
{
var value = Syntax switch
{
WorkflowScriptSyntax.Liquid => await _expressionEvaluator.EvaluateAsync(LiquidValue, workflowContext, null),
WorkflowScriptSyntax.JavaScript => await _scriptEvaluator.EvaluateAsync(Value, workflowContext),
_ => throw new NotSupportedException($"The syntax {Syntax} isn't supported for SetPropertyTask.")
};
workflowContext.Properties[PropertyName] = value;
return Outcome("Done");
}
}
View on GitHub (pinned to 4306c0717f)