Skip to content

Regression in 6.0.0: Dictionary<string, object> keys no longer resolved in RuleExpressionParser expressions #720

@florianwakam

Description

@florianwakam

Description

RulesEngine version: 6.0.0 (regression from 5.0.3)

When evaluating expressions via RuleExpressionParser.Evaluate<bool>() with a RuleParameter wrapping a Dictionary<string, object>, dictionary keys are no longer resolved as named properties in the expression. Instead, the key name appears to be treated as a string literal, making the evaluation always return a fixed value regardless of the dictionary contents.

Root Cause

The underlying System.Linq.Dynamic.Core was upgraded from 1.3.7 (v5.0.3) to 1.6.0.1 (v6.0.0). This upgrade introduced a breaking change in how dictionary keys are resolved when used as a RuleParameter.

Minimal Reproduction

var parser = new RuleExpressionParser(new ReSettings());

var payload = new Dictionary<string, object>
{
    { "Formule", "Essentielle" }
};

var ruleParameters = new[] { RuleParameter.Create("_", payload) };

// In v5.0.3: correctly returns false ("Essentielle" != "Essentielle" => false)
// In v6.0.0: always returns true, ignores dictionary value
bool result = parser.Evaluate<bool>("Formule!=""Essentielle""", ruleParameters);

Console.WriteLine(result); // Expected: false — Actual: true

Observed Behavior (v6.0.0)

The expression Formule!="Essentielle" with payload { "Formule": "Essentielle" } returns true instead of false. The dictionary value is completely ignored — the expression appears to compare the string literal "Formule" against "Essentielle", which always evaluates to true for != regardless of what is in the dictionary.

Symmetrically, Formule="Essentielle" always returns false.

Expected Behavior (v5.0.3)

The dictionary key "Formule" is resolved to its value "Essentielle", so:

  • Formule!="Essentielle"false
  • Formule="Essentielle"true

Impact

This is a silent regression: no exception is thrown, evaluations simply always return a constant value regardless of the input dictionary. Any conditional rule that relies on a Dictionary<string, object> payload is silently broken after upgrading to 6.0.0.

Workaround

Reverting to RulesEngine 5.0.3 restores correct behavior. We have not yet found a configuration or API change in 6.0.0 that fixes this while staying on 6.0.0.

Environment

  • .NET 10
  • RulesEngine 6.0.0 (broken) / 5.0.3 (working)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions