From 5ff4db1a5d22efb02300457d9a7a3154a7a5b0cb Mon Sep 17 00:00:00 2001 From: Vitek Karas Date: Sat, 25 Jul 2020 11:11:14 -0700 Subject: [PATCH] Add linker annotation to LazyDebugView to avoid warnings (#39899) 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 which has the same annotation, so the T will always fulfill the annotation's requirements. --- src/libraries/System.Private.CoreLib/src/System/Lazy.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Lazy.cs b/src/libraries/System.Private.CoreLib/src/System/Lazy.cs index 918682f..4fcfbc9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Lazy.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Lazy.cs @@ -508,7 +508,7 @@ namespace System /// 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. - internal sealed class LazyDebugView + internal sealed class LazyDebugView<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] T> { // The Lazy object being viewed. private readonly Lazy _lazy; -- 2.7.4