From c77507e1e4d786e2df0e7581cdb412c8def7069b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 21 May 2026 10:09:15 +0900 Subject: [PATCH] Add DataFlowInPrimaryConstructor test case --- .../DataFlow/ConstructorDataFlow.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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))]