In reality this is only to get rid of the warnings, the class is never instatiated by the managed code, so the annotation has no effect on including more code.
When in debugger the class is instatiated with the same T of an existing Lazy<T> which has the same annotation, so the T will always fulfill the annotation's requirements.
/// <summary>A debugger view of the Lazy<T> to surface additional debugging properties and
/// to ensure that the Lazy<T> does not become initialized if it was not already.</summary>
- internal sealed class LazyDebugView<T>
+ internal sealed class LazyDebugView<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] T>
{
// The Lazy object being viewed.
private readonly Lazy<T> _lazy;