Skip to content

Commit f8c9806

Browse files
amcaseyeerhardt
andauthored
Remove unnecessary pragmas (#55810)
* Remove unnecessary pragmas ...now that dotnet/linker#2715 has been fixed. * Remove some additional suppressions * Fix build * Add RequiresDynamicCode attribute because we are using MakeGenericMethod on a Type that may be a value type. --------- Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
1 parent 83aa6b1 commit f8c9806

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

src/Http/Http.Results/src/ResultsOfTHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ internal static class ResultsOfTHelper
4747
}
4848
}
4949

50-
// TODO: Remove IL3050 suppress when https://github.com/dotnet/linker/issues/2715 is complete.
51-
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Validated with IsDynamicCodeSupported check.")]
50+
[RequiresDynamicCode("The native code for the PopulateMetadata<TTarget> instantiation might not be available at runtime.")]
5251
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:MakeGenericMethod",
5352
Justification = "The call to MakeGenericMethod is safe due to the fact that PopulateMetadata<TTarget> does not have a DynamicallyAccessMembers attribute and TTarget is annotated to preserve all methods to preserve the PopulateMetadata method.")]
5453
static void InvokeGenericPopulateMetadata(object[] parameters)

src/Http/Routing/src/Matching/JumpTableBuilder.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Diagnostics.CodeAnalysis;
54
using System.Runtime.CompilerServices;
65
using System.Text;
76

@@ -89,8 +88,6 @@ public static JumpTable Build(int defaultDestination, int exitDestination, (stri
8988
// Use the ILEmitTrieJumpTable if the IL is going to be compiled (not interpreted)
9089
return MakeILEmitTrieJumpTableIfSupported(defaultDestination, exitDestination, pathEntries, fallback);
9190

92-
// TODO: This suppression can be removed when https://github.com/dotnet/linker/issues/2715 is complete.
93-
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Guarded by IsDynamicCodeCompiled")]
9491
static JumpTable MakeILEmitTrieJumpTableIfSupported(int defaultDestination, int exitDestination, (string text, int destination)[] pathEntries, JumpTable fallback)
9592
{
9693
// ILEmitTrieJumpTable use IL emit to generate a custom, high-performance jump table.

src/Shared/PropertyHelper/PropertyHelper.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ public static PropertyHelper[] GetVisibleProperties(
212212
// MakeGenericMethod + value type requires IsDynamicCodeSupported to be true.
213213
if (RuntimeFeature.IsDynamicCodeSupported)
214214
{
215-
// TODO: Remove disable when https://github.com/dotnet/linker/issues/2715 is complete.
216-
#pragma warning disable IL3050 // Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.
217215
// Instance methods in the CLR can be turned into static methods where the first parameter
218216
// is open over "target". This parameter is always passed by reference, so we have a code
219217
// path for value types and a code path for reference types.
@@ -233,7 +231,6 @@ public static PropertyHelper[] GetVisibleProperties(
233231
getMethod,
234232
propertyGetterWrapperMethod);
235233
}
236-
#pragma warning restore IL3050 // Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.
237234
}
238235
else
239236
{
@@ -287,8 +284,6 @@ public static PropertyHelper[] GetVisibleProperties(
287284
// MakeGenericMethod + value type requires IsDynamicCodeSupported to be true.
288285
if (RuntimeFeature.IsDynamicCodeSupported)
289286
{
290-
// TODO: Remove disable when https://github.com/dotnet/linker/issues/2715 is complete.
291-
#pragma warning disable IL3050 // Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.
292287
// Instance methods in the CLR can be turned into static methods where the first parameter
293288
// is open over "target". This parameter is always passed by reference, so we have a code
294289
// path for value types and a code path for reference types.
@@ -305,7 +300,6 @@ public static PropertyHelper[] GetVisibleProperties(
305300
typeof(Action<object, object?>), propertySetterAsAction);
306301

307302
return (Action<object, object?>)callPropertySetterDelegate;
308-
#pragma warning restore IL3050 // Calling members annotated with 'RequiresDynamicCodeAttribute' may break functionality when AOT compiling.
309303
}
310304
else
311305
{

0 commit comments

Comments
 (0)