question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with expression evaluation

See original GitHub issue

I’m new to Elsa and find the framework to be very robust. I was easily able to get the engine and workflow designer up and running. I was also able to develop a custom activity with an input parameter defined as follows:

public WorkflowExpression<string> FirstName { get => GetState(() => new WorkflowExpression<string>(LiteralEvaluator.SyntaxName, “”)); set => SetState(value); }

In this Activity i am setting an output variable as follows: Output.SetVariable(“ProviderOutput”, $“Person:{FirstName}”);

I’ve added this activity to the workflow and set the named instance to ProvOut. I’ve set the FirstName property with a literal value and it’s setting the value appropriately when i step through the custom activity.

I’ve then added the activity into the workflow again to test passing a value from one activity to another. The second activity is passing the FirstName property as follows (the expression type is Liquid): {{Activities.ProvOut.ProviderOutput}}

When i attempt to evaluate this i am getting an object reference error from the LiquidExpression evaluator. Here is a snippet of code from the OnExecuteAsync() method:

var firstName = await expressionEvaluator.EvaluateAsync( FirstName, workflowContext, cancellationToken );

My services are configured as follows:

services .AddElsa(elsa => elsa.AddEntityFrameworkStores<SqliteContext>(options => options.UseSqlite(Configuration.GetConnectionString(“Sqlite”)))) .AddHttpActivities(options => options.Bind(Configuration.GetSection(“Elsa:Http”))) .AddEmailActivities(options => options.Bind(Configuration.GetSection(“Elsa:Smtp”)))
.AddActivity<MapProvider>() .AddTimerActivities(options => options.Bind(Configuration.GetSection(“Elsa:Timers”))) .AddElsaDashboard();

This is the error i am receiving: “Error while evaluating Liquid expression "{{Activities.ProvOut.ProviderOutput}}". Message: Object reference not set to an instance of an object.”

And here is the stack trace " at Elsa.Expressions.WorkflowExpressionEvaluator.<EvaluateAsync>d__3.MoveNext()\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\n at Elsa.Extensions.WorkflowExpressionEvaluatorExtensions.<EvaluateAsync>d__01.MoveNext()\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\n at ElsaCustomActivities.MapProvider.<OnExecuteAsync>d__6.MoveNext() in /Users/larrymartin/Projects/ElsaTest/ElsaCustomActivities/Class1.cs:line 42"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
lmartinjrcommented, Sep 29, 2020

Can you check the F12 Developer Tools and see what the actual HTTP response is when requesting http://localhost:59003/_content/Elsa.Dashboard/assets/js/plugins/elsa-workflows/elsa-workflow-designer/elsa-workflow-designer.esm.js? Possibly you are getting a 404. In which case: make sure to follow these steps to build the client-side assets:

  1. Run NPM install on src\dashboard\Elsa.Dashboard\Theme\argon-dashboard
  2. Execute gulp build from the directory src\dashboard\Elsa.Dashboard\Theme\argon-dashboard

Let me know if this works or not.

Thanks! That’s exactly what i needed. I now have a dev environment set up and i’m able to step through the code.

0reactions
lmartinjrcommented, Oct 4, 2020

They way to do this is by creating a fork of this project and cloning that fork to your local machine (or update your local clone of this repo with the remote URL of the fork you will create), push your changes to your fork, and submit a PR.

This article explains the steps nicely.

Thanks Spike. I’ve now submitted a PR for review. I was able to confirm the code change worked as expected by creating an activity and assigning a name. I then checked the database (was using EF as persistence) and could confirm after making the change the Name column in the datastore was set. For testing i was using EF and SQLLite.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expression Evaluation
Evaluate an expression represented by a String. The expression can contain parentheses, you can assume parentheses are well-matched.
Read more >
Problems in Expression Evaluation
Problems in Expression Evaluation. For Complete YouTube Video: Click Here. In this class, we will try to understand Problems in Expression Evaluation.
Read more >
c# - "Internal error in the expression evaluator"
I've encountered a problem in expression evaluator of visual studio 2015 that says "Internal error in the expression evaluator", ...
Read more >
Expression Evaluation Failed - Apply to each
Hi all,. I'm having trouble getting an apply to each operation to work correctly. ... This same function is carried out in a...
Read more >
InternalError: Expression evaluation in async frames is not ...
ChromeProxyService: Failed to evaluate expression 'completer': InternalError: Expression evaluation in async frames is not supported.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found