Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
invalidoperationexception: operation is not valid due to the current state of the object. system.reflection.runtimemethodinfo.getgenericmethoddefinition() yessql.services.defaultquery.convertfragment(istringbuilder builder, expression expression)
I am setting a property on the workflow context to log any expressions which evaluates to null, I am testing with a sqlite database.
code in the custom IWorkflowExpressionEvaluator
public async Task<T> EvaluateAsync<T>(
WorkflowExpression<T> expression,
WorkflowExecutionContext workflowContext,
TextEncoder encoder)
{
var templateContext = new TemplateContext(_templateOptions);
var expressionContext = new WorkflowExecutionExpressionContext(templateContext, workflowContext);
await _workflowContextHandlers.InvokeAsync((h, expressionContext) => h.EvaluatingExpressionAsync(expressionContext), expressionContext, _logger);
// Set WorkflowContext as a local scope property.
var result = await _liquidTemplateManager.RenderStringAsync(
expression.Expression,
encoder ?? NullEncoder.Default,
new Dictionary<string, FluidValue>() { ["Workflow"] = new ObjectValue(workflowContext) }
);
if(string.IsNullOrWhiteSpace(result) || result.Equals("null", StringComparison.InvariantCultureIgnoreCase))
{
if(expression.Expression is not null)
{
LogErrorMessage(
string.Format("{0} evaluates to null", expression.Expression),
workflowContext);
}
return default;
}
return (T)Convert.ChangeType(result, typeof(T));
}
private void LogErrorMessage(string message, WorkflowExecutionContext context)
{
if(context.Properties.ContainsKey(NullExpressionPropertyName))
{
var listOfNull = context.Properties[NullExpressionPropertyName] as string[];
if(listOfNull != null)
{
listOfNull = listOfNull.Append(message).ToArray();
context.Properties[NullExpressionPropertyName] = listOfNull;
}
} else
{
context.Properties[NullExpressionPropertyName] = new string[] { message };
}
}
Describe the bug
To Reproduce
Steps to reproduce the behavior:
I am setting a property on the workflow context to log any expressions which evaluates to null, I am testing with a sqlite database. code in the custom IWorkflowExpressionEvaluator
Expected behavior
To be able to navigate to the workflow type index