Skip to content

Commit 682a90e

Browse files
authored
Merge pull request #311 from exyi/remove-contant-cast
Remove Castclass from complex constants on .NET Core
2 parents be17c10 + 7b8d59b commit 682a90e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/FastExpressionCompiler/FastExpressionCompiler.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2991,8 +2991,14 @@ private static bool TryEmitConstantOfNotNullValue(
29912991
il.Emit(OpCodes.Ldelem_Ref);
29922992
if (exprType.IsValueType)
29932993
il.Emit(OpCodes.Unbox_Any, exprType);
2994-
else // todo: @perf it is probably required only for Full CLR starting from NET45, e.g. `Test_283_Case6_MappingSchemaTests_CultureInfo_VerificationException`
2994+
else
2995+
{
2996+
// this is probably required only for Full CLR starting from NET45, e.g. `Test_283_Case6_MappingSchemaTests_CultureInfo_VerificationException`
2997+
// .NET Core does not seem to care about verifiability and it's faster without the explicit cast
2998+
#if NETFRAMEWORK
29952999
il.Emit(OpCodes.Castclass, exprType);
3000+
#endif
3001+
}
29963002
}
29973003
}
29983004
else

0 commit comments

Comments
 (0)