From c5767b45fe3691daa39bc32b5544b63a65727bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Tue, 9 May 2023 16:19:09 +0900 Subject: [PATCH] Stop special casing reflected-on internals Concept of reflection blocked internals was deleted in #85810. This is no longer needed. --- .../src/CompatibilitySuppressions.xml | 8 ------- .../Tracing/TraceLogging/PropertyValue.cs | 22 +++---------------- .../System/Resources/RuntimeResourceSet.cs | 7 +----- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml b/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml index 86675997e2cbaa..0883ff244559c5 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/CompatibilitySuppressions.xml @@ -804,10 +804,6 @@ CP0001 T:System.Diagnostics.DebuggerGuidedStepThroughAttribute - - CP0001 - T:System.Diagnostics.Tracing.PropertyValue - CP0001 T:System.MDArray @@ -872,10 +868,6 @@ CP0001 T:System.Reflection.RuntimeAssemblyName - - CP0001 - T:System.Resources.RuntimeResourceSet - CP0001 T:System.Runtime.CompilerServices.EagerStaticClassConstructionAttribute diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs index 5b5f9c77b1ff53..cd6237c3fcc758 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/PropertyValue.cs @@ -13,13 +13,7 @@ namespace System.Diagnostics.Tracing /// /// To get the value of a property quickly, use a delegate produced by . /// -#if NATIVEAOT - [CLSCompliant(false)] - public // On NativeAOT, this must be public to prevent it from getting reflection blocked. -#else - internal -#endif - readonly unsafe struct PropertyValue + internal readonly unsafe struct PropertyValue { /// /// Union of well-known value types, to avoid boxing those types. @@ -202,12 +196,7 @@ private static Func GetReferenceTypePropertyGetter return helper.GetPropertyGetter(property); } -#if NATIVEAOT - public // On NativeAOT, this must be public to prevent it from getting reflection blocked. -#else - private -#endif - abstract class TypeHelper + private abstract class TypeHelper { public abstract Func GetPropertyGetter(PropertyInfo property); @@ -219,12 +208,7 @@ protected static Delegate GetGetMethod(PropertyInfo property, Type propertyType) } } -#if NATIVEAOT - public // On NativeAOT, this must be public to prevent it from getting reflection blocked. -#else - private -#endif - sealed class ReferenceTypeHelper : TypeHelper where TContainer : class + private sealed class ReferenceTypeHelper : TypeHelper where TContainer : class { private static Func GetGetMethod(PropertyInfo property) where TProperty : struct => property.GetMethod!.CreateDelegate>(); diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs index d5af57f74188d6..314c90e122ebb7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/RuntimeResourceSet.cs @@ -154,12 +154,7 @@ namespace System.Resources // into smaller chunks, each of size sqrt(n), would be substantially better for // resource files containing thousands of resources. // -#if NATIVEAOT - public // On NativeAOT, this must be public to prevent it from getting reflection blocked. -#else - internal -#endif - sealed class RuntimeResourceSet : ResourceSet, IEnumerable + internal sealed class RuntimeResourceSet : ResourceSet, IEnumerable { // Cache for resources. Key is the resource name, which can be cached // for arbitrarily long times, since the object is usually a string