diff options
author | Vitek Karas <10670590+vitek-karas@users.noreply.github.com> | 2022-07-14 22:38:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 22:38:12 +0300 |
commit | 072ebe7c115e80bf2555bb5f02049379e6bf9722 (patch) | |
tree | a9bc2688acedc1ed692873297e01c397850486a5 /test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs | |
parent | e2b3a925b1ee6c55f9b95540647ce8362fe9ee44 (diff) |
Fix a bug with null value passed to annotated parameter on attribute (#2894)
This also makes small tweaks to help with linker->AOT sync.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs index 2cac037c5..01fa19c20 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributeFieldDataflow.cs @@ -16,9 +16,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow { [KeptAttributeAttribute (typeof (KeepsPublicConstructorsAttribute))] [KeptAttributeAttribute (typeof (KeepsPublicMethodsAttribute))] + [KeptAttributeAttribute (typeof (KeepsPublicFieldsAttribute))] [KeptAttributeAttribute (typeof (TypeArrayAttribute))] [KeepsPublicConstructors (Type = typeof (ClassWithKeptPublicConstructor))] [KeepsPublicMethods (Type = "Mono.Linker.Tests.Cases.DataFlow.AttributeFieldDataflow+ClassWithKeptPublicMethods")] + [KeepsPublicFields (Type = null, TypeName = null)] [TypeArray (Types = new Type[] { typeof (AttributeFieldDataflow) })] // Trimmer only for now - https://github.com/dotnet/linker/issues/2273 [ExpectedWarning ("IL2026", "--ClassWithKeptPublicMethods--", ProducedBy = ProducedBy.Trimmer)] @@ -58,6 +60,27 @@ namespace Mono.Linker.Tests.Cases.DataFlow public string Type; } + // Use to test null values + [Kept] + [KeptBaseType (typeof (Attribute))] + class KeepsPublicFieldsAttribute : Attribute + { + [Kept] + public KeepsPublicFieldsAttribute () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + public Type Type; + + [Kept] + [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + public string TypeName; + } + [Kept] class ClassWithKeptPublicConstructor { |