Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve some easy NativeAOT warnings. #35560

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ namespace Microsoft.EntityFrameworkCore;
"MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called "
+ "from user code - so it's never trimmed. After https://github.com/dotnet/linker/issues/2482 is fixed, the suppression will no "
+ "longer be necessary.")]
[UnconditionalSuppressMessage(
"AOT",
"IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.",
Justification =
"MakeGenericMethod is used in this class to create MethodCallExpression nodes, but only if the method in question is called "
+ "from user code - so it's never trimmed.")]
public static class EntityFrameworkQueryableExtensions
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Query/QueryableMethods.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;

namespace Microsoft.EntityFrameworkCore.Query;

/// <summary>
Expand Down Expand Up @@ -458,6 +460,7 @@ public static MethodInfo GetSumWithSelector(Type type)
private static Dictionary<Type, MethodInfo> SumWithoutSelectorMethods { get; }
private static Dictionary<Type, MethodInfo> SumWithSelectorMethods { get; }

[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "Types used here in 'MakeGenericType' are types like 'TSource', not specific types.")]
static QueryableMethods()
{
var queryableMethodGroups = typeof(Queryable)
Expand Down
2 changes: 2 additions & 0 deletions src/Shared/EnumerableMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.EntityFrameworkCore;

Expand Down Expand Up @@ -248,6 +249,7 @@ public static MethodInfo GetMinWithoutSelector(Type type)
public static MethodInfo GetMinWithSelector(Type type)
=> MinWithSelectorMethods.GetValueOrDefault(type, MinWithSelector);

[UnconditionalSuppressMessage("AOT", "IL3050:Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.", Justification = "Types used here in 'MakeGenericType' are types like 'TSource', not specific types.")]
static EnumerableMethods()
{
var queryableMethodGroups = typeof(Enumerable)
Expand Down
Loading