Skip to content

Commit

Permalink
Cleanup + PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabYourPitchforks committed Nov 17, 2020
1 parent 2467fdd commit eb368eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ public static int OffsetToStringData
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool TryEnsureSufficientExecutionStack();

private static unsafe object GetUninitializedObjectInternal(Type type)
private static unsafe object GetUninitializedObjectInternal(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
Type type)
{
RuntimeType rt = (RuntimeType)type;
Debug.Assert(rt != null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3999,6 +3999,7 @@ private void Initialize(RuntimeType type)
delegate*<MethodTable*, object?> pfnNewobj = RuntimeTypeHandle.GetNewobjHelperFnPtr(type, out _pMT, unwrapNullable: false, allowCom: true);
if (_pMT->IsNullable)
{
static object? GetNull(MethodTable* pMT) => null;
pfnNewobj = &GetNull; // Activator.CreateInstance(typeof(Nullable<T>)) => null
}

Expand All @@ -4014,8 +4015,6 @@ public void EnsureInitialized(RuntimeType type)
Initialize(type);
}
}

private static object? GetNull(MethodTable* pMT) => null;
}

/// <summary>
Expand Down

0 comments on commit eb368eb

Please sign in to comment.