freshcrate
Skin:/
Home > Testing > FastExpressionCompiler

FastExpressionCompiler

Fast Compiler for C# Expression Trees and the lightweight LightExpression alternative. Diagnostic and code generation tools for the expressions.

Why this rank:Strong adoptionRelease freshnessHealthy release cadence

Description

Fast Compiler for C# Expression Trees and the lightweight LightExpression alternative. Diagnostic and code generation tools for the expressions.

README

FastExpressionCompiler

logo

Latest Release NotesLicenseBuild Windows,Ubuntu

Targets .NET 6+, .NET 4.7.2+, .NET Standard 2.0+

NuGet packages:

  • FastExpressionCompiler NuGet VersionNuGet Downloads
    • sources package: FastExpressionCompiler.src NuGet VersionNuGet Downloads
    • sources with the public code made internal: FastExpressionCompiler.Internal.src NuGet VersionNuGet Downloads
  • FastExpressionCompiler.LightExpression NuGet VersionNuGet Downloads
    • sources package: FastExpressionCompiler.LightExpression.src NuGet VersionNuGet Downloads
    • sources with the public code made internal: FastExpressionCompiler.LightExpression.Internal.src NuGet VersionNuGet Downloads

The project was originally a part of the DryIoc, so check it out ;-)

The problem

ExpressionTree compilation is used by the wide variety of tools, e.g. IoC/DI containers, Serializers, ORMs and OOMs. But Expression.Compile() is just slow. Moreover the compiled delegate may be slower than the manually created delegate because of the reasons:

TL;DR;

Expression.Compile creates a DynamicMethod and associates it with an anonymous assembly to run it in a sand-boxed environment. This makes it safe for a dynamic method to be emitted and executed by partially trusted code but adds some run-time overhead.

See also a deep dive to Delegate internals.

The solution

The FastExpressionCompiler .CompileFast() extension method is 10-40x times faster than .Compile().
The compiled delegate may be in some cases a lot faster than the one produced by .Compile().

Note: The actual performance may vary depending on the multiple factors: platform, how complex is expression, does it have a closure, does it contain nested lambdas, etc.

In addition, the memory consumption taken by the compilation will be much smaller (check the Allocated column in the benchmarks below).

Benchmarks

Updated to .NET 9.0

BenchmarkDotNet v0.15.0, Windows 11 (10.0.26100.4061/24H2/2024Update/HudsonValley)
Intel Core i9-8950HK CPU 2.90GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET SDK 9.0.203
[Host]     : .NET 9.0.4 (9.0.425.16305), X64 RyuJIT AVX2
DefaultJob : .NET 9.0.4 (9.0.425.16305), X64 RyuJIT AVX2

Hoisted expression with the constructor and two arguments in closure

var a = new A();
var b = new B();
Expression<Func<X>> e = () => new X(a, b);

Compiling expression:

Method Mean Error StdDev Ratio RatioSD Rank Gen0 Gen1 Allocated Alloc Ratio
CompileFast 3.183 us 0.0459 us 0.0407 us 1.00 0.02 1 0.1984 0.1945 1.23 KB 1.00
Compile 147.312 us 1.9291 us 1.8946 us 46.28 0.81 2 0.4883 0.2441 4.48 KB 3.65

Invoking the compiled delegate (comparing to the direct constructor call):

Method Mean Error StdDev Ratio RatioSD Rank Gen0 Allocated Alloc Ratio
DirectConstructorCall 6.055 ns 0.0632 ns 0.0560 ns 1.00 0.01 1 0.0051 32 B 1.00
CompiledLambda 7.853 ns 0.2013 ns 0.1681 ns 1.30 0.03 2 0.0051 32 B 1.00
FastCompiledLambda 7.962 ns 0.2186 ns 0.4052 ns 1.31 0.07 2 0.0051 32 B 1.00

Hoisted expression with the static method and two nested lambdas and two arguments in closure

var a = new A();
var b = new B();
Expression<Func<X>> getXExpr = () => CreateX((aa, bb) => new X(aa, bb), new Lazy<A>(() => a), b);

Compiling expression:

Method Mean Error StdDev Ratio RatioSD Rank Gen0 Gen1 Allocated Alloc Ratio
CompileFast 11.12 us 0.189 us 0.158 us 1.00 0.02 1 0.6104 0.5798 3.77 KB 1.00
Compile 415.09 us 4.277 us 3.571 us 37.34 0.60 2 1.9531 1.4648 12.04 KB 3.19

Invoking compiled delegate comparing to direct method call:

Method Mean Error StdDev Ratio RatioSD Rank Gen0 Allocated Alloc Ratio
DirectMethodCall 40.29 ns 0.549 ns 0.487 ns 1.00 0.02 1 0.0268 168 B 1.00
Invoke_CompiledFast 40.59 ns 0.157 ns 0.123 ns 1.01 0.01 1 0.0166 104 B 0.62
Invoke_Compiled 1,142.12 ns 11.877 ns 14.586 ns 28.35 0.48 2 0.0420 264 B 1.57

Manually composed expression with parameters and closure

var a = new A();
var bParamExpr = Expression.Parameter(typeof(B), "b");
var expr = Expression.Lambda(
    Expression.New(_ctorX,
        Expression.Constant(a, typeof(A)), bParamExpr),
    bParamExpr);

Compiling expression:

Method Mean Error StdDev Ratio RatioSD Rank Gen0 Gen1 Allocated Alloc Ratio
CompileFast_LightExpression 3.107 us 0.0562 us 0.0498 us 0.99 0.02 1 0.1755 0.1678 1.08 KB 1.00
CompileFast_SystemExpression 3.126 us 0.0288 us 0.0256 us 1.00 0.01 1 0.1755 0.1678 1.08 KB 1.00
Compile_SystemExpression 103.948 us 1.9593 us 2.5477 us 33.26 0.84 2 0.7324 0.4883 4.74 KB 4.40

Invoking the compiled delegate compared to the normal delegate and the direct call:

Method Mean Error StdDev Ratio Rank Gen0 Allocated Alloc Ratio
DirectCall 10.19 ns 0.108 ns 0.085 ns 1.00 1 0.0051 32 B 1.00
CompiledFast_LightExpression 10.70 ns 0.089 ns 0.070 ns 1.05 2 0.0051 32 B 1.00
CompiledFast_SystemExpression 10.91 ns 0.071 ns 0.066 ns 1.07 2 0.0051 32 B 1.00
Compiled_SystemExpression 11.59 ns 0.098 ns 0.081 ns 1.14 3 0.0051 32 B 1.00

FastExpressionCompiler.LightExpression.Expression vs System.Linq.Expressions.Expression

FastExpressionCompiler.LightExpression.Expression is the lightweight version of System.Linq.Expressions.Expression. It is designed to be a drop-in replacement for the System Expression - just install the FastExpressionCompiler.LightExpression package instead of FastExpressionCompiler and replace the usings

using System.Linq.Expressions;
using static System.Linq.Expressions.Expression;

with

using static FastExpressionCompiler.LightExpression.Expression;
namespace FastExpressionCompiler.LightExpression.UnitTests

You may look at it as a bare-bone wrapper for the computation operation node which helps you to compose the computation tree (without messing with the IL emit directly). It won't validate operations compatibility for the tree the way System.Linq.Expression does it, and partially why it is so slow. Hopefully you are checking the expression arguments yourself and not waiting for the Expression exceptions to blow-up.

Sample expression

Creating the expression:

Method Mean Error StdDev Median Ratio RatioSD Rank Gen0 Allocated Alloc Ratio
Create_LightExpression 156.6 ns 3.19 ns 8.18 ns 151.9 ns 1.00 0.07 1 0.0827 520 B 1.00
Create_SystemExpression 1,065.0 ns 14.24 ns 11.89 ns 1,069.3 ns 6.82 0.34 2 0.2060 1304 B 2.51

Creating and compiling:

Method Mean Error StdDev Median Ratio RatioSD Rank Gen0 Gen1 Allocated Alloc Ratio
Create_LightExpression_and_CompileFast 4.957 us 0.0986 us 0.2362 us 4.913 us 1.00 0.07 1 0.3510 0.3052 2.15 KB 1.00
Create_SystemExpression_and_CompileFast 6.518 us 0.1889 us 0.5541 us 6.300 us 1.32 0.13 2 0.4578 0.4272 2.97 KB 1.38
Create_SystemExpression_and_Compile 205.000 us 4.0938 us 7.3819 us 206.353 us 41.44 2.45 3 0.9766 0.4883 7.15 KB 3.33

Difference between FastExpressionCompiler and FastExpressionCompiler.LightExpression

FastExpressionCompiler

  • Provides the CompileFast extension methods for the System.Linq.Expressions.LambdaExpression.

FastExpressionCompiler.LightExpression

  • Provides the CompileFast extension methods for FastExpressionCompiler.LightExpression.LambdaExpression.
  • Provides the drop-in expression replacement with the less consumed memory and the faster construction at the cost of the less validation.
  • Includes its own ExpressionVisitor.
  • Supports ToExpression method to convert back to the System.Linq.Expressions.Expression.
  • Supports ToLightExpression conversion method to convert from the System.Linq.Expressions.Expression to FastExpressionCompiler.LightExpression.Expression.

Both FastExpressionCompiler and FastExpressionCompiler.LightExpression

  • Support ToCSharpString() method to output the compilable C# code represented by the expression.
  • Support ToExpressionString() method to output the expression construction C# code, so given the expression object you'll get e.g. Expression.Lambda(Expression.New(...)).

Who's using it

Marten, Rebus, StructureMap, Lamar, ExpressionToCodeLib, NServiceBus, LINQ2DB, MapsterMapper

Considering: Moq, Apex.Serialization

How to use

Install from the NuGet and add the using FastExpressionCompiler; and replace the call to the .Compile() with the .CompileFast() extension method.

Note: CompileFast has an optional parameter bool ifFastFailedReturnNull = false to disable fallback to Compile.

Examples

Hoisted lambda expression (created by the C# Compiler):

var a = new A(); var b = new B();
Expression<Func<X>> expr = () => new X(a, b);

var getX = expr.CompileFast();
var x = getX();

Manually composed lambda expression:

var a = new A();
var bParamExpr = Expression.Parameter(typeof(B), "b");
var expr = Expression.Lambda(
    Expression.New(_ctorX,
        Expression.Constant(a, typeof(A)), bParamExpr),
    bParamExpr);

var f = expr.CompileFast();
var x = f(new B());

Note: You may simplify Expression usage and enable faster refactoring with the C# using static statement:

using static System.Linq.Expressions.Expression;
// or
// using static FastExpressionCompiler.LightExpression.Expression;

var a = new A();
var bParamExpr = Parameter(typeof(B), "b");
var expr = Lambda(
    New(_ctorX, Constant(a, typeof(A)), bParamExpr),
    bParamExpr);

var f = expr.CompileFast();
var x = f(new B());

How it works

The idea is to provide the fast compilation for the supported expression types and fallback to the system Expression.Compile() for the not supported types:

What's not supported yet

FEC does not support yet:

  • Quote
  • Dynamic
  • RuntimeVariables
  • DebugInfo
  • MemberInit with the MemberMemberBinding and the ListMemberBinding binding types
  • NewArrayInit multi-dimensional array initializer is not supported yet

To find what nodes are not supported in your expression you may use the technic described below in the Diagnostics section.

The compilation is done by traversing the expression nodes and emitting the IL. The code is tuned for the performance and the minimal memory consumption.

The expression is traversed twice:

  • 1st round is to collect the constants and nested lambdas into the closure objects.
  • 2nd round is to emit the IL code and create the delegate using the DynamicMethod.

If visitor finds the not supported expression node or the error condition, the compilation is aborted, and null is returned enabling the fallback to System .Compile().

Diagnostics and Code Generation

FEC V3 has added powerful diagnostics and code generation tools.

Diagnostics

You may pass the optional CompilerFlags.EnableDelegateDebugInfo into the CompileFast methods.

EnableDelegateDebugInfo adds the diagnostic info into the compiled delegate including its source Expression and compiled IL code.

It can be used as following:

System.Linq.Expressions.Expression<Func<int, Func<int>>> e = 
  n => () => n + 1;
var f = e.CompileFast(flags: CompilerFlags.EnableDelegateDebugInfo);
var d = f.TryGetDebugInfo();
d.PrintExpression();
d.PrintCSharp();
d.PrintIL(); // available in NET8+
Expand to see the output of the above code...

Output of d.PrintExpression() is the valid C#:

var p = new ParameterExpression[1]; // the parameter expressions
var e = new Expression[3]; // the unique expressions
var expr = Lambda<Func<int, Func<int>>>(
  e[0]=Lambda<Func<int>>(
      e[1]=MakeBinary(ExpressionType.Add,
          p[0]=Parameter(typeof(int), "n"),
          e[2]=Constant(1)), new ParameterExpression[0]),
  p[0 // (int n)
      ]);

Output of d.PrintCSharp() is the valid C#:

var @cs = (Func<int, Func<int>>)((int n) => //Func<int>
    (Func<int>)(() => //int
        n + 1));

Output of d.PrintIL() (includes the IL of the nested lambda):

<Caller>
0   ldarg.0
1   ldfld object[] ExpressionCompiler.ArrayClosure.ConstantsAndNestedLambdas
6   stloc.0
7   ldloc.0
8   ldc.i4.0
9   ldelem.ref
10  stloc.1
11  ldloc.1
12  ldc.i4.1
13  newarr object
18  stloc.2
19  ldloc.2
20  stfld object[] ExpressionCompiler.NestedLambdaForNonPassedParams.NonPassedParams
25  ldloc.2
26  ldc.i4.0
27  ldarg.1
28  box int
33  stelem.ref
34  ldloc.1
35  ldfld object ExpressionCompiler.NestedLambdaForNonPassedParams.NestedLambda
40  ldloc.2
41  ldloc.1
42  ldfld object[] ExpressionCompiler.NestedLambdaForNonPassedParamsWithConstants.ConstantsAndNestedLambdas
47  newobj ExpressionCompiler.ArrayClosureWithNonPassedParams(System.Object[], System.Object[])
52  call Func<int> ExpressionCompiler.CurryClosureFuncs.Curry(System.Func`2[FastExpressionCompiler.LightExpression.ExpressionCompiler+ArrayClosure,System.Int32], ArrayClosure)
57  ret
</Caller>
<0_nested_in_Caller>
0   ldarg.0
1   ldfld object[] ExpressionCompiler.ArrayClosureWithNonPassedParams.NonPassedParams
6   ldc.i4.0
7   ldelem.ref
8   unbox.any int
13  ldc.i4.1
14  add
15  ret
</0_nested_in_Caller>

ThrowOnNotSupportedExpression and NotSupported_ flags

FEC V3.1 has added the compiler flag CompilerFlags.ThrowOnNotSupportedExpression. When passed to CompileFast(flags: CompilerFlags.ThrowOnNotSupportedExpression) and the expression contains not (yet) supported Expression node the compilation will throw the exception instead of returning null.

To get the whole list of the not yet supported cases you may check in Result.NotSupported_ enum values.

Code Generation

The Code Generation capabilities are available via the ToCSharpString and ToExpressionString extension methods.

Note: When converting the source expression to either C# code or to the Expression construction code you may find the // NOT_SUPPORTED_EXPRESSION comments marking the not supported yet expressions by FEC. So you may test the presence or absence of this comment.

Additional optimizations

  1. Using FastExpressionCompiler.LightExpression.Expression instead of System.Linq.Expressions.Expression for the faster expression creation.
  2. Using .TryCompileWithPreCreatedClosure and .TryCompileWithoutClosure methods when you know the expression at hand and may skip the first traversing round, e.g. for the "static" expression which does not contain the bound constants. Note: You cannot skip the 1st round if the expression contains the Block, Try, or Goto expressions.

Bitten Ice Pop icon icon by Icons8

Release History

VersionChangesUrgencyDate
v5.4.1## v5.4.1 Bug-fix release - #498 System.InvalidProgramException when using loop - #499 System.InvalidProgramException for Sorting and comparison function **Contributions**: @bluewingHuang **Full Changelog**: https://github.com/dadhi/FastExpressionCompiler/compare/v5.4.0...v5.4.1High4/13/2026
v5.4.0## v5.4.0 Feature and bug-fix release ### Features - #398 Optimize Switch with OpCodes.Switch - #484 PrintIL options to output op-codes in the format directly copyable to AssertOpCodes method - #482 [impl] Update to the modern optimized and fixed versions of ImTools SmallList and SmallMap ### Fixes - Multiple fixes in `ToCSharpString`, `PrintCSharp` - #480 "CLR detected an invalid program" exception - #483 fix recursive PrintIL output for Label Offset and Argument Ordinal - #Medium3/30/2026
v5.3.3## v5.3.3 Bug-fix release (src packages only) - fixed: #488 Fix warnings in src package Low10/31/2025
v5.3.2## v5.3.2 Bug-fix release (src packages only) - fixed: #481 The 5.3.0 source package is broken and doesn't include all required source files Low10/22/2025
v5.3.1## v5.3.1 Bug-fix release (src packages only) - fixed: #481 The 5.3.0 source package is broken and doesn't include all required source filesLow10/21/2025
v5.3.0## v5.3.0 Feature release - feat: [performance] Reuse the ILGenerator used by the nested lambda compilation - feat: [performance] Reuse DynamicMethod if possible - feat: Add debug diagnostics to the nested lambdas - fix: System.ExecutionEngineException with nullables on repeated calls to ConcurrentDictionary **Full Changelog**: https://github.com/dadhi/FastExpressionCompiler/compare/v5.2.0...v5.3.0Low6/10/2025
v5.2.0## v5.2.0 Feature release - feat: #466 Simplify creation of the updateable value that can be put into Closure with the Expression.ConstantRef - feat: #472 Interpreter to reduce the IL emitted by the Logical, Comparison, Arithmetics expressions, by calculating them during compile time and using the calculation result in IL - feat: Expose TestTools and FastExpressionCompiler.ILDecoder to enable testing and diagnostic in the consumer code Low5/12/2025
v5.1.1## v5.1.1. Bug-fix release - fix: #461 InvalidProgramException when null checking type by ref - fix: #462 Optimize Equality comparison with null **Full Changelog**: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1Low4/2/2025
v5.1.0## v5.1.0 Small feature release - add: #458 Add Support for TryFault - fix: #460 ArgumentException when converting from object to type with explicit operator **Full Changelog**: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0Low3/31/2025
v5.0.3## v5.0.3 Bug-fix release - fix: #451 Operator implicit/explicit produces InvalidProgram - fix: #455 TypeAs should return null when it cannot cast to a nullable #455 **Full Changelog**: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3Low3/26/2025
v5.0.2## v5.0.2 Bug-fix release -fix: #449 MemberInit produces InvalidProgram **Full Changelog**: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2Low1/29/2025
v5.0.1## v5.0.1 Bug-fix release - fix: #437 Shared variables with nested lambdas returning incorrect values - fix: #439 Support unused Field access in Block - fix: #440 Errors with simplified Switch cases - fix: #441 Fails to pass Constant as call parameter by-reference - fix: #442 TryCatch and the Goto outside problems - fix: #443 Nested Calls with Lambda Parameters Throwing NotSupportedExpressionException Low12/22/2024
v5.0.0## v5.0.0 Major feature release - feat: #271 Add conversion from the System Expression to the Light Expression to allow hoisted system expression embedding in the larger light expression - feat: #432 Add explicit target for .NET 9 - feat: #434 ToCSharpString should generate stable names for the unnamed variables, parameters and labels - fix: #262 Optimize OpCode.Ceq plus Branch into a single compare-and-branch - fix: #424 TryCatch expression as argument in Call expression produces invalLow11/22/2024
v4.2.2## v4.2.2 Bug-fix release - fix: #418 Wrong output when comparing NaN value - fix: #419 System.InvalidProgramException : The JIT compiler encountered invalid IL code or an internal limitation - fix: #420 Nullable<DateTime> comparison differs from Expression.Compile - fix: #421 Date difference is giving wrong negative value - fix: #422 [bug] InvalidProgramException when having TryCatch + Default in Catch - fix: #423 Converting a uint to a float gives the wrong resultLow10/13/2024
v4.2.1## v4.2.1 Feature and bug-fix release - fix: ImTools should disable the nullable context - fix: nullable property - fix: Incorrect il for struct indexer - fix: Fix or support return ref value - fix: Incorrect il when passing by ref value ## Contributors * @sebastienros made contribution in https://github.com/dadhi/FastExpressionCompiler/pull/412 ## Full Changelog https://github.com/dadhi/FastExpressionCompiler/compare/v4.2.0...v4.2.1Low7/2/2024
v4.2.0## v4.2.0 Feature and bug-fix release - feat: #133 Optimize Switch Expression - feat: #393 Support ToCSharpString of the block in the ternary expression - feat: #396 Optimize conditional expressions with the DefaultExpression left or right operand the same way as ConstantExpression - fix: #390 System.AccessViolationException when mapping using Mapster - fix: #391 ToCSharpString outputs ? for Nullable which does not produce the compile-able code - fix: #392 ToExpressionString wrongly deLow4/29/2024
v4.1.0## v4.1.0 Small feature and bug-fix release - added: #379 Add direct net8.0 target as soon as Appveyor CI will support it - fixed: #380 Comparisons with nullable types - fixed: #381 NullReferenceException with V4.X when trying to map - fixed: #386 Value can not be null(parametr 'meth') Low1/20/2024
v4.0.1## v4.0.1 Bug-fix release - fixed: #374 CompileFast doesn't work with HasFlagLow11/23/2023
v4.0.0## v4.0.0 Major release - fixed: #352 xxxAssign doesn't work with MemberAccess - fixed: #353 NullReferenceException when calling CompileFast() results - fixed: #357 Invalid program exception - fixed: #366 FastExpressionCompiler[v3.3.4] gives incorrect results in some linq operations - fixed: #368 Fix duplicate nested lambda compilation - fixed: #374 CompileFast doesn't work with HasFlag - added: #264 Optimize the array index emit to emit specific Ldelem_ code instead of generic LdelemLow11/12/2023
v3.3.4## v3.3.4 Bug-fix release - fixed: #345 EmitCall is for the varargs method and should not be used for normal convention - fixed: #347 InvalidProgramException on compiling an expression that returns a record which implements IList - fixed: #349 Error when loading struct parameters closed by the nested lambda e.g. predicate in Linq - fixed: #355 Error with converting to/from signed/unsigned integers (Thanks to @TYoungSL for the PR!) - fixed: the C# output for if-else test condition, and iLow1/17/2023
v3.3.3## v3.3.3 Bug-fix release - fixed: #336 Method TryCompileBoundToFirstClosureParam is returning passed Type array to pool may cause undefined behavior - fixed: #337 Switch LightExpression.Expression.ToString from System.Expression.ToString pseudo-code to ToCSharpString - fixed: #338 InvocationExpression is not properly converted to System Expression via ToExpression for non-lambda expression - fixed: #341 Equality comparison between nullable and null inside Any produces incorrect compiled eLow7/24/2022
v3.3.2## v3.3.2 Bug-fix release - fixed: #335 FastExpressionCompiler.LightExpressions - MemberInit has recursive calls Low5/27/2022
v3.3.1## v3.3.1 Optimization and bug-fix release - fixed: #333 AccessViolationException and other suspicious behaviour on invoking result of CompileFast() - optim: LightExpression.Parameter consumes less memory for the common standard types. Low5/25/2022
v3.3.0## v3.3.0 Feature and bug-fix release - added: #235 [GodMode] Expression to IL intrinsic - added: #325 Add LightExpression.NewNoByRefArgs overloads for performance - added: #327 Replace direct il.Emit(OpCodes.Call, ...) with EmitMethodCall - added: #329 Optimize special case compilation for New and Call with no arguments - added: #330 Optimize nested lambda ClosureInfo memory footprint - fixed: #324 The LightExpression.New of IEnumerable is recursive - fixed: #328 Fix the performance ofLow4/26/2022
v3.2.2## v3.2.2 Bug-fix release - fixed: #284 Invalid Program after Coalesce - fixed: #308 Wrong delegate type returned (with closure) - fixed: #310 InvalidProgramException when nullable result is ignored - fixed: #316 in parameter - fixed: #319 NRE in IndexExpression.get_ArgumentCount - fixed: #320 "Bad label content in ILGenerator" when creating through DynamicModule - fixed: #321 Call with out parameter to field type that is not value type fails Low2/2/2022
v3.2.1## v3.2.1 Bug-fix release - fixed: #307 Switch with fall through throws "System.InvalidProgramException: 'Common Language Runtime detected an invalid program.'" Low7/21/2021
v3.2.0## v3.2.0 Bug-fix and optimization release - fixed: #305 CompileFast generates incorrect code with arrays and printing - fixed: added missing Expression.MakeCatchBlock - optimized: memory of Expression of T - optimized: for the custom MethodCallExpression - optimized: adding the ConstantInt and ConstantOf without boxing and null constant with the less space Low6/14/2021
v3.1.0## v3.1.0 Feature and bug-fix release - added: #297 Add custom Constant to string output in the ToCSharpString and ToExpressionString - added: #303 Add CompilerFlags.ThrowOnNotSupportedException and throw NotSupportedExpressionException when the flag is passed to CompileFast - fixed: #301 Another case of the InvalidOperationException in the Mapster - fixed: ListInit compilation for the Dictionary - fixed: the lookup for the non-public property setter Low5/3/2021
3.0.5## v3.0.5 Bug-fix release - fixed: another case in #301 InvalidOperationException in the Mapster - fixed: multiple problems with the TryCatch C# and Expression string output Low4/21/2021
v3.0.4## v3.0.4 Bug-fix release - fixed: #302 Error compiling expression with array accessLow4/6/2021
v3.0.3## v3.0.3 Bug-fix release - fixed: #301 InvalidOperationException in the Mapster - fixed: small bugs in the Lambda ToCSharpString output Low4/1/2021
v3.0.2## v3.0.2 Bug-fix release - fixed: #300 Bad label content in ILGenerator in the Mapster benchmark with FEC V3 - fixed: Small issues with the `ToCSharpString()`, specifically in the TryCatch, and the Goto, and the Label expressionsLow3/30/2021
v3.0.1## v3.0.1 Bug-fix release fixed: #298 LightExpression with the NewExpression of 4 arguments has ArgumentCount = 3Low3/25/2021
v3.0.0## v3.0.0 - Major feature release This version contains a lot of fixes and improvements and as-little-as-possible breaking changes. ### **FastExpressionCompiler** and **FastExpressionCompiler.LightExpression** - Performance and memory consumption are improved, especially for the expressions with the closure and for expressions with the nested lambdas. - More expression types are supported. - Many fixes in the IL Emit. - Added `ToCSharpString()` extension method to output the compile-Low3/17/2021
v2.0.0## Major release Contains breaking changes, but **likely or lucky you'll need to re-compile only**. ### Thanks V2 was developed with a strong help of @jogibear9988, @dzmitry-lahoda, @MaceWindu, and other contributors - kudos to all of them! ### The main change FEC package now is split in two: [FastExpressionCompiler (FEC)] and [FastExpressionCompiler.LightExpression (FEC.LE)]. The packages are not dependent on each other and may be used together. FEC.LightExpression allows Low1/25/2019
v1.7.1## Bugfix release ### Fixes - fixed: #67 Equality comparison with nullables throws at delegate-invokeLow3/27/2018
v1.7.0## Minor release ### Adds - added: #56 Add ExpressionInfo.TryCatch, Block and Throw ### Fixes - fixed: #55 CompileFast crash with ref parameter - fixed: #60 Support all types and operations from System.Numerics Low3/17/2018

Dependencies & License Audit

Loading dependencies...

Similar Packages

little-coderA coding agent optimized to smaller LLMsv1.8.2
ai-test-case๐Ÿค– Generate automated test cases for your GitHub repositories using AI, ensuring comprehensive coverage with seamless integration and multi-language support.main@2026-06-06
SignSign integrity generic notationmain@2026-06-06
vector-db-benchmarkFramework for benchmarking vector search enginesmaster@2026-06-05
octobenchBenchmark and compare LLM tool, configuration, and prompt setups using a shared case framework with automated scoring and telemetry.main@2026-06-02

More in Testing

vector-db-benchmarkFramework for benchmarking vector search engines
GitoAn AI-powered GitHub code review tool that uses LLMs to detect high-confidence, high-impact issuesโ€”such as security vulnerabilities, bugs, and maintainability concerns.
mxcliMendix cli tool, a headless way to work with Mendix projects. Enables Mendix projects for use with 3rd party agentic coding tools like Claude Code and Copilot. Includes a starlark linter for quality v
llm_context_benchmarks ๐Ÿ“Š LLM Context Benchmarks - A comprehensive benchmarking tool for testing LLMs with varying context sizes using Ollama. Features dual benchmark modes (API/CLI), automatic hardware detection (optimiz