From 13bb9b0832b9a65bd50b4a17fd6c69d89cc869e0 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Thu, 6 Jan 2022 18:10:11 +0200 Subject: [PATCH] Add [DynamicDependency] on System.Math for trimming (#27098) Fixes #27097 --- src/EFCore.Relational/Query/IMethodCallTranslator.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/EFCore.Relational/Query/IMethodCallTranslator.cs b/src/EFCore.Relational/Query/IMethodCallTranslator.cs index 0f815b4edab..b6e2ecebe74 100644 --- a/src/EFCore.Relational/Query/IMethodCallTranslator.cs +++ b/src/EFCore.Relational/Query/IMethodCallTranslator.cs @@ -1,7 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Reflection; using Microsoft.EntityFrameworkCore.Diagnostics; @@ -28,6 +30,9 @@ public interface IMethodCallTranslator /// SQL representations of . /// The query logger to use. /// A SQL translation of the . + // This is a 6.0.x hack to make trimming work, since the linker doesn't see our GetRequiredRuntimeMethod invocations below + // (see #26288) + [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(Math))] SqlExpression? Translate( SqlExpression? instance, MethodInfo method,