Skip to content

Commit

Permalink
Stop special casing reflected-on internals
Browse files Browse the repository at this point in the history
Concept of reflection blocked internals was deleted in dotnet#85810. This is no longer needed.
  • Loading branch information
MichalStrehovsky committed May 9, 2023
1 parent 7d54c05 commit c5767b4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -804,10 +804,6 @@
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Diagnostics.DebuggerGuidedStepThroughAttribute</Target>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Diagnostics.Tracing.PropertyValue</Target>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.MDArray</Target>
Expand Down Expand Up @@ -872,10 +868,6 @@
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Reflection.RuntimeAssemblyName</Target>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Resources.RuntimeResourceSet</Target>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Runtime.CompilerServices.EagerStaticClassConstructionAttribute</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ namespace System.Diagnostics.Tracing
///
/// To get the value of a property quickly, use a delegate produced by <see cref="PropertyValue.GetPropertyGetter(PropertyInfo)"/>.
/// </summary>
#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
{
/// <summary>
/// Union of well-known value types, to avoid boxing those types.
Expand Down Expand Up @@ -202,12 +196,7 @@ public int ScalarLength
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<PropertyValue, PropertyValue> GetPropertyGetter(PropertyInfo property);

Expand All @@ -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<TContainer> : TypeHelper where TContainer : class
private sealed class ReferenceTypeHelper<TContainer> : TypeHelper where TContainer : class
{
private static Func<TContainer, TProperty> GetGetMethod<TProperty>(PropertyInfo property) where TProperty : struct =>
property.GetMethod!.CreateDelegate<Func<TContainer, TProperty>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5767b4

Please sign in to comment.