delegateas/ExpressionEngine

Can not parse expression

Closed this issue · 1 comments

Description

No matter how the expression is written, it will output as it is

Reproduction Steps

Using Visual Studio 2022 create ASP.NET Core Web / .Net 6.0 and install Delegate.ExpressionEngine 4.1.2

Code :

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
var services = new ServiceCollection();
services.AddExpressionEngine();
var sp = services.BuildServiceProvider();
var ee = sp.GetRequiredService<IExpressionEngine>();
var str = ee.Parse("1 + 1").Result;
Console.WriteLine(str); // output "1 + 1"
app.Run();

Expected behavior

2

Actual behavior

1 + 1

Configuration

  • Visual Studio 2022
  • .Net 6.0
  • Windows 10 21H2 / x64
  • Delegate.ExpressionEngine 4.1.2

Other information

The .csproj is :

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Delegate.ExpressionEngine" Version="4.1.2" />
  </ItemGroup>

</Project>

Hello there,

1 + 1 is not a valid expression, to add two numbers it should be add(1, 1).

The expression language is taken from Power Automate, so you can look here for more documentation :) https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference