Table of Contents

Upgrade guide

This guide lists what changed between major versions and what you need to do. The complete history is in the change log.

To 6.x

No breaking API changes. Behavior you may notice:

  • The compiled-expression cache is back (it was removed in 5.0.1), which speeds up many paths dramatically.
  • Workflow GlobalParams are evaluated once per ExecuteAllRulesAsync call, not once per rule.
  • Duplicate GlobalParams or LocalParams names are rejected when the workflow is added, and an input with the same name as a global parameter is reported as a rule error.
  • EnableExceptionAsErrorMessage = false now also rethrows exceptions raised by custom actions.
  • ExecuteActionWorkflowAsync formats ErrorMessage templates like ExecuteAllRulesAsync does.
  • New settings: EnableAssemblyScanning, AutoExecuteActions and EnableParallelRuleCompilation, and an ExecuteAllRulesAsync overload that takes a CancellationToken.

From 4.x to 5.0

Breaking: expressions can call methods and use static members only on registered types. This fixed a security issue in System.Linq.Dynamic.Core.

What to do:

  1. Add the types your rules call to ReSettings.CustomTypes.
  2. Input types are registered automatically (AutoRegisterInputType, added in 5.0.1). Strongly typed inputs and nested types that your rules call methods on may need explicit registration if you turned that setting off.

See the type security model.

From 3.x to 4.0

Breaking:

  • ILogger was removed from every constructor. Change new RulesEngine(workflows, logger, reSettings) to new RulesEngine(workflows, reSettings).
  • Obsolete members were removed:
    • RuleResultTree.ToResultTreeMessages() and GetMessages();
    • RuleResultTree.RuleEvaluatedParams (use Inputs);
    • Rule.ErrorType;
    • ReSettings.EnableLocalParams (use EnableScopedParams).
  • The 3.4 legacy names (WorkflowRules, WorkflowRulesToInject, RuleAction) still exist in 6.x, marked [Obsolete]. Move to Workflow, WorkflowsToInject and RuleActions.
  • The library targets .NET 6 and .NET Standard 2.0 and no longer depends on Microsoft.Extensions.Logging or MemoryCache.

From 2.x to 3.x

Breaking:

  • ExecuteRule was renamed ExecuteAllRulesAsync, and it is asynchronous.
  • RuleResultTree.Input became Inputs, a dictionary of all input names and values.
  • (3.2) AddWorkflow throws if the workflow name already exists. Use AddOrUpdateWorkflow to replace it.
  • (3.3) Rule.Actions changed from Dictionary<ActionTriggerType, ActionInfo> to RuleActions with OnSuccess and OnFailure. JSON files are not affected; workflows built in code need updating.
  • (3.4) Types were renamed: WorkflowRules to Workflow, WorkflowRulesToInject to WorkflowsToInject, RuleAction to RuleActions. The old names were kept as obsolete aliases.

Check after upgrading

  1. Run your rules with representative inputs and compare the IsSuccess and ExceptionMessage of each result with the previous version.
  2. Look for Exception while parsing expression messages: a call on a type that is no longer registered shows up there.
  3. Warm up and time your largest workflows. See Performance.