Skip to content

Commit

Permalink
Remove unnecessary DynamicDependency in CoreLib (dotnet#71369)
Browse files Browse the repository at this point in the history
* The ones on `CreateArraySortHelper` were introduced before we introduced dataflow annotations on `CreateInstanceForAnotherGenericParameter`. This should now just fall out naturally.
* The ones on `InvokerEmitUtil` were added recently in dotnet#67917. I'm going to assume it's just a cargo cult because the reflection within the methods is fully analyzable. We would need warning suppressions if it wasn't.
  • Loading branch information
MichalStrehovsky authored Jun 28, 2022
1 parent cc3ac1b commit 333742b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal sealed partial class ArraySortHelper<T>

public static IArraySortHelper<T> Default => s_defaultArraySortHelper;

[DynamicDependency("#ctor", typeof(GenericArraySortHelper<>))]
private static IArraySortHelper<T> CreateArraySortHelper()
{
IArraySortHelper<T> defaultArraySortHelper;
Expand Down Expand Up @@ -55,7 +54,6 @@ internal sealed partial class ArraySortHelper<TKey, TValue>

public static IArraySortHelper<TKey, TValue> Default => s_defaultArraySortHelper;

[DynamicDependency("#ctor", typeof(GenericArraySortHelper<,>))]
private static IArraySortHelper<TKey, TValue> CreateArraySortHelper()
{
IArraySortHelper<TKey, TValue> defaultArraySortHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,14 @@ public static void Throw_NullReference_InvokeNullRefReturned()
private static class Methods
{
private static MethodInfo? s_ByReferenceOfByte_Value;
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(ByReference<>))]
public static MethodInfo ByReferenceOfByte_Value() =>
s_ByReferenceOfByte_Value ??= typeof(ByReference<byte>).GetMethod("get_Value")!;

private static MethodInfo? s_ThrowHelper_Throw_NullReference_InvokeNullRefReturned;
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(ThrowHelper))]
public static MethodInfo ThrowHelper_Throw_NullReference_InvokeNullRefReturned() =>
s_ThrowHelper_Throw_NullReference_InvokeNullRefReturned ??= typeof(ThrowHelper).GetMethod(nameof(ThrowHelper.Throw_NullReference_InvokeNullRefReturned))!;

private static MethodInfo? s_Pointer_Box;
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(Pointer))]
public static MethodInfo Pointer_Box() =>
s_Pointer_Box ??= typeof(Pointer).GetMethod(nameof(Pointer.Box), new[] { typeof(void*), typeof(Type) })!;

Expand Down

0 comments on commit 333742b

Please sign in to comment.