Skip to content

Commit ea946ea

Browse files
committed
Revert "Add runtime shim for LambdaExpression.Compile(bool)" - it's no op in NetFX
This reverts commit 5c8ad16.
1 parent 32d674d commit ea946ea

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
using System;
22
using System.Linq.Expressions;
3-
using System.Reflection;
43

54
namespace NHibernate.Impl
65
{
76
#if NET461
87
internal static class LambdaExpressionExtensions
98
{
10-
//NET4.6.1 does not have this method exposed,
11-
//however it might be available in runtime
12-
private static readonly MethodInfo CompileWithPreference = typeof(LambdaExpression)
13-
.GetMethod("Compile", new[] { typeof(bool) });
14-
15-
public static Delegate Compile(this LambdaExpression expression, bool preferInterpretation)
16-
{
17-
if (CompileWithPreference != null)
18-
{
19-
return (Delegate) CompileWithPreference.Invoke(expression, new object[] { preferInterpretation });
20-
}
21-
22-
return expression.Compile(); //Concurrent Compile() call causes "Garbage Collector" suspend all threads too often
23-
}
9+
public static Delegate Compile(this LambdaExpression expression, bool preferInterpretation) =>
10+
expression.Compile(); //Concurrent Compile() call causes "Garbage Collector" suspend all threads too often
2411
}
2512
#endif
2613
}

0 commit comments

Comments
 (0)