Table of Contents

6.1.0

6.0.0

Breaking Changes

  • Public domain types moved out of the NCalc.Domain namespace and into NCalc. For example, use NCalc.LogicalExpression, NCalc.BinaryExpression, NCalc.Function, and NCalc.ValueExpression instead of NCalc.Domain.*.
  • Parser types now live in the new NCalc.Parser assembly. Projects that use parser APIs directly must reference NCalc.Parser and NCalc.Domain in addition to NCalc.Core when those assemblies are not brought in transitively.
  • ArgumentSeparator was renamed to LogicalExpressionArgumentSeparator. LogicalExpressionParserOptions no longer exposes Default, WithCultureInfo, WithArgumentSeparator, Create, or the implicit CultureInfo conversion; use object initialization or the new constructors instead.
  • Sync and async evaluation were unified in NCalc.Core. AsyncExpression, AsyncExpressionContext, IAsyncExpressionFactory, AsyncExpressionFactory, IAsyncEvaluationVisitorFactory, AsyncEvaluationVisitorFactory, and AsyncEvaluationVisitor were removed; use Expression, ExpressionContext, IExpressionFactory, IEvaluationVisitorFactory, and Expression.EvaluateAsync instead.
  • Async DI customization methods were removed from NCalcServiceBuilder: use WithExpressionFactory and WithEvaluationVisitorFactory instead of WithAsyncExpressionFactory and WithAsyncEvaluationVisitorFactory.
  • Function and parameter callback delegates and argument types now use unified types in NCalc.Handlers. FunctionArgs, ParameterArgs, ExpressionFunctionData, ExpressionParameterData, AsyncFunctionArgs, AsyncParameterArgs, AsyncExpressionFunctionData, and AsyncExpressionParameterData were replaced by FunctionEventArgs, ParameterEventArgs, FunctionData, and ParameterData.
  • Function callback arguments no longer expose arrays of nested Expression or AsyncExpression instances. FunctionData exposes LogicalExpression arguments and provides Evaluate(index) / EvaluateAsync(index) helpers for evaluating them with the current ExpressionContext.
  • AsyncExpressionFunction now returns Task<object?> and receives FunctionData. AsyncExpressionParameter was removed; dynamic parameters now use ExpressionParameter.
  • ExpressionBase<TExpressionContext> and ExpressionContextBase were removed. Custom expression types should derive from or compose Expression and use ExpressionContext.
  • LogicalExpression.ToString() no longer serializes the expression tree. Use ToExpressionString() from NCalc.Extensions when an expression string representation is required.
  • Public CancellationToken parameter names were renamed from ct to cancellationToken. Calls that use named arguments must be updated.
  • Evaluation failures may now be wrapped in NCalcEvaluationException; inspect InnerException for the original exception.

5.13.0

5.12.0

New Contributors

  • @joriszwart made their first contribution in #545

5.11.0

5.10.0

5.9.0

5.8.0

Breaking Changes

This change can cause upcasting types in some cases. Also after theese changes an operator overload can be used for any types. For example, subtracting 2 dates will return a TimeSpan value, in previous versions the InvalidOperationException was thrown.

5.7.0

5.6.0

Breaking Changes

5.5.0

Breaking Changes

  • The number with fractional part with scientific notation without specifying fractional part is not valid anymore (123.E2 is not a valid expression anymore, should be 123.0E2)

5.4.1

5.4.0

Breaking Changes

  • Removed IEvaluationService, please use IEvaluationVisitorFactory. Check this article for more info.

5.3.1

5.3.0

Breaking Changes

5.2.11

5.2.10

5.2.9

5.2.8

5.2.7

5.2.6

5.2.5

5.2.4

5.2.3

5.2.2

5.2.1

5.2.0

5.1.0

5.0.0

Breaking Changes

  • NCalcAsync now uses AsyncExpressionContext
  • ExpressionContext is now a record instead of a class, allowing support for shallow cloning
  • IEvaluationVisitor is removed, please use IEvaluationService for an easier to implement interface
  • ILogicalExpressionVisitor is now ILogicalExpressionVisitor<T>, where <T> is the return of the visitor
  • IAsyncLogicalExpressionVisitor is removed, please use ILogicalExpressionVisitor<Task<object?>>
  • AdvancedExpression and AsyncAdvancedExpression are removed, please use the respective constructors at Expression and AsyncExpression to prevent unnecessary casting.

4.3.3

4.3.2

4.3.1

4.3.0

Breaking Changes

  • Expression is now AsyncExpression at NCalcAsync, related classes are also prefixed with Async to prevent naming collisions
  • Removed obsolete HasOption extension method from ExpressionOptions, please use HasFlag
  • Removed obsolete CaseInsensitiveComparer enum member, please use CaseInsensitiveStringComparer

4.2.1

4.2

Breaking Changes

4.1

4.0

Breaking Changes

  • .NET Framework 4.6.1 no longer supported, please update to .NET Framework 4.6.2 or higher
  • Renamed EvaluateOptions enum to ExpressionOptions
  • Renamed EvaluateOptionsExtensions class to ExpressionOptionsExtensions
  • Renamed Expression.OriginalExpression property to Expression.ExpressionString
  • Renamed Expression.ParsedExpression property to Expression.LogicalExpression
  • Renamed Numbers static class to MathHelper
  • Removed Expression.Compile static method, please use LogicalExpressionFactory.Create
  • Removed unused BinaryExpressionType.Unknown enum value
  • Expression.Error property now stores an Exception object instead of a string
  • Expression.GetParametersNames method now returns a List<String> instead of a string[]

3.13.1

3.13

3.12

3.11

3.10

3.9

3.8

3.7

3.6

3.5

3.4

3.2

3.1

3.0

Several syntax changes to the grammar:

While these changes in themselves wouldn't introduce compatibility issues with previously valid statements, code that relies on statements with these constructs being invalid would be affected. The grammar also had to be regenerated with a new version of ANTLR with some fixes to it since it was clear that the generated source code had been modified manually. Manual review indicates that the regenerated grammar is identical, but because of both these reasons this is released as a new major version.

  • Bugfix: invalid tokens were skipped silently without any errors. Expressions like "4711" would ignore the " (since that is not the string character in the NCalc syntax) and parse it as the number 4711, but now an EvaluationException is thrown as for other syntax issues. This may affect existing expressions, but since they were always incorrect and now give an exception rather than silently getting a new value it does not merit a new major release.
  • Major bugfix: long integers are now treated as integers. Previous versions converted them to single-precision floats, which caused data loss on large numbers. Since this affects the results of existing expressions, it requires a new major release.
  • New builtin function Ln()

2.0

Initial public release of the .NET Core version.