diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ConstructorDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ConstructorDataFlow.cs index 60309e3acdc96f..88d1a4fc10c8d8 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ConstructorDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ConstructorDataFlow.cs @@ -18,6 +18,7 @@ public class ConstructorDataFlow public static void Main() { DataFlowInConstructor.Test(); + DataFlowInPrimaryConstructor.Test(); DataFlowInStaticConstructor.Test(); } @@ -95,6 +96,18 @@ public static void Test() } } + class DataFlowInPrimaryConstructor(Type type) + { + [ExpectedWarning("IL2069", nameof(annotatedField), nameof(type))] + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] + Type annotatedField = type; + + public static void Test() + { + new DataFlowInPrimaryConstructor(null); + } + } + class DataFlowInStaticConstructor { [ExpectedWarning("IL2072", nameof(GetUnknown), nameof(RequireAll))]