NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
NuGet
NuGet, #1004 most downloaded on NuGet
FastExpressionCompiler 5. 10-40x times faster than Expression.Compile()
Latest stable
6.0.0
Last release 1 months ago
07 Oct 2026
Release timing varies
gaps range from 2 weeks to 10 months
Most releases are documented
notes for 35 of 52 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
73 releases · first in 2017
Drag across the ruler to compare, or tap a release to open it.
The new supported target frameworks are .NET 8.0, .NET 10.0, .NET 4.7.2, .NET Standard 2.1
Multiple fixes in ToCSharpString, PrintCSharp
Contributions: @bluewingHuang
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.4.0...v5.4.1
ToCSharpString, PrintCSharphttps://github.com/dadhi/FastExpressionCompiler/compare/v5.3.3...v5.4.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.2.0...v5.3.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Multiple fixes in ToCSharpString, PrintCSharp
ToCSharpString, PrintCSharphttps://github.com/dadhi/FastExpressionCompiler/compare/v5.3.3...v5.4.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.2.0...v5.3.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
feat: [performance] Reuse the ILGenerator used by the nested lambda compilation
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.2.0...v5.3.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
feat: #466 Simplify creation of the updateable value that can be put into Closure with the Expression.ConstantRef
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
add: Expose TestTools and FastExpressionCompiler.ILDecoder to enable testing and diagnostic in the consumer projects
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
fix: #461 InvalidProgramException when null checking type by ref
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
fix: #461 InvalidProgramException when null checking type by ref
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.1.0...v5.1.1
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
add: #458 Add Support for TryFault
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.3...v5.1.0
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
fix: #451 Operator implicit/explicit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.2...v5.0.3
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
-fix: #449 MemberInit produces InvalidProgram
-fix: #449 MemberInit produces InvalidProgram
Full Changelog: https://github.com/dadhi/FastExpressionCompiler/compare/v5.0.1...v5.0.2
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
fix: #437 Shared variables with nested lambdas returning incorrect values
feat: #271 Add conversion from the System Expression to the Light Expression to allow hoisted system expression embedding in the larger light expressi
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 invalid program
fix: #426 Directly passing a method result to another method by ref, fails with InvalidProgramException
fix: #427 CSharp output with more consistency, robustness and more understandable code
fix: #428 Expression.Switch without a default case incorrectly calls first case for unmatched values
fix: #430 TryCatch - Bad label content in ILGenerator
fix: #418 Wrong output when comparing NaN value
fix: ImTools should disable the nullable context
https://github.com/dadhi/FastExpressionCompiler/compare/v4.2.0...v4.2.1
feat: #133 Optimize Switch Expression
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 declares Label instead of LabelTarget array
fix: #394 Calling a user defined == operator runs into a CLR invalid program exception
fix: #397 Fix and optimize the Switch support
fix: #399 Coalesce nullable with 0 is not working
fix: #400 Fix the direct assignment of Try to Member expression because indirect assignment through tmp var works
fix: #401 Invoke inlining is not working with collections in AutoMapper tests
fix: #404 An expression with a single parameter concatenated to a string causes 'Exception has been thrown by the target of an invocation' during delegate invocation
fix: #405 NullReferenceException with V4.X when using long?[]
fix: #406 NullReferenceException with V4.X
fix: #407 NullReferenceException when setting the Enum field
fix: #408 Dictionary mapping failing when the InvocationExpression inlining is involved
added: #379 Add direct net8.0 target as soon as Appveyor CI will support it
Nothing published for this version
fixed: #374 CompileFast doesn't work with HasFlag
fixed: #352 xxxAssign doesn't work with MemberAccess
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 Ldelem
added: #273 Implement IArgumentProvider for the BlockExpression to minimize the consumed memory
added: #346 Is it possible to implement ref local variables?
added: #359 Improve the performance of variable lookup
added: #367 Better diagnostics and debugging with error codes from Collect and Compile rounds
added: #369 Decrease memory occupied by the LightExpression Block by storing Expression in SmallList (partly on stack)
added: #370 Optimize any nested lambda compilation (LINQ) by compiling right after collect one-by-one
added: #372 Support LightExpression.Expression.TryConvertDelegateIntrinsic for converting one type of delegate to another
added: #373 Support custom C# printing for the LightExpression.Expression
Nothing published for this version
fixed: #345 EmitCall is for the varargs method and should not be used for normal convention
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 inc/dec operations; and for label at the end of the lambda
fixed: ref assignment C# output
perf: Replace ILGenerator.Emit(OpCodes.Call, ..) with EmitMethodCall performance
fixed: #336 Method TryCompileBoundToFirstClosureParam is returning passed Type array to pool may cause undefined behavior
fixed: #335 FastExpressionCompiler.LightExpressions - MemberInit has recursive calls
fixed: #333 AccessViolationException and other suspicious behaviour on invoking result of CompileFast()
added: #235 [GodMode] Expression to IL intrinsic
fixed: #284 Invalid Program after Coalesce
fixed: #307 Switch with fall through throws "System.InvalidProgramException: 'Common Language Runtime detected an invalid program.'"
fixed: #305 CompileFast generates incorrect code with arrays and printing
added: #297 Add custom Constant to string output in the ToCSharpString and ToExpressionString
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
fixed: another case in #301 InvalidOperationException in the Mapster
fixed: #302 Error compiling expression with array access
fixed: #301 InvalidOperationException in the Mapster
fixed: #300 Bad label content in ILGenerator in the Mapster benchmark with FEC V3
ToCSharpString(), specifically in the TryCatch, and the Goto, and the Label expressionsfixed: #298 LightExpression with the NewExpression of 4 arguments has ArgumentCount = 3
fixed: #298 LightExpression with the NewExpression of 4 arguments has ArgumentCount = 3
This version contains a lot of fixes and improvements and as-little-as-possible breaking changes.
This version contains a lot of fixes and improvements and as-little-as-possible breaking changes.
ToCSharpString() extension method to output the compile-able C# code described by the expression (tries hard).ToExpressionString() extension method to output the valid expression construction syntax, so given an expression object you'll get e.g. Lambda(New(...)).enum CompilerFlags { Default, NoInvocationLambdaInlining, EnableDelegateDebugInfo} parameter for the compilationEnableDelegateDebugInfo adds the diagnostic info into the compiled delegate including its source Expression and C# code. Can be used as following: var f = e.CompileFast(true, CompilerFlags.EnableDelegateDebugInfo);
var di = f.Target as IDelegateDebugInfo;
Assert.IsNotNull(di.Expression);
Assert.IsNotNull(di.ExpressionString);
Assert.IsNotNull(di.CSharpString);
ExpressionVisitor.FastExpressionCompiler.LightExpression.Expression and the System.Linq.Expression.IArgumentProvider and IParameterProvider for some expressions.Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Contains breaking changes, but likely or lucky you'll need to re-compile only.
Contains breaking changes, but likely or lucky you'll need to re-compile only.
V2 was developed with a strong help of @jogibear9988, @dzmitry-lahoda, @MaceWindu, and other contributors - kudos to all of them!
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 a drop-in replacement for manually created expression, the only change is different namespace using. LE.Expression is "lighter" because it is faster created and consumes less memory. It does it by avoiding most of compatibility and verification checks. But it does not mean it is not safe! You can convert it to System Expression as easy as calling ToExpression or ToLambdaExpression and it will run the usual verification. This conversation also enables fallback to Expression.Compile inside the CompileFast.
ExpressionInfo and supporting logic is moved from FEC to FEC.LEExpressionInfo is renamed to Expression but moved into new namespace FastExpressionCompiler.LightExpressionExpressionInfo noise and now is much simpler and lost 33% LOC.LIGHT_EXPRESSION build variable controlling what to compile: System.Linq.Expressions.Expression or FastExpressionCompiler.LightExpressionint.TryParseNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
fixed: #67 Equality comparison with nullables throws at delegate-invoke
added: #56 Add ExpressionInfo.TryCatch, Block and Throw
Nothing published for this version
Nothing published for this version
One column per quarter.