diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs index 1b10390ea..a944bb742 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/AttributePropertyDataflow.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.AttributePropertyDataflow+ClassWithKeptPublicMethods")] + [KeepsPublicFields (Type = null, TypeName = null)] [TypeArray (Types = new Type[] { typeof (AttributePropertyDataflow) })] // Trimmer only for now - https://github.com/dotnet/linker/issues/2273 [ExpectedWarning ("IL2026", "--ClassWithKeptPublicMethods--", ProducedBy = ProducedBy.Trimmer)] @@ -60,6 +62,29 @@ namespace Mono.Linker.Tests.Cases.DataFlow public string Type { get; [Kept] set; } } + // Used to test null values + [Kept] + [KeptBaseType (typeof (Attribute))] + class KeepsPublicFieldsAttribute : Attribute + { + [Kept] + public KeepsPublicFieldsAttribute () + { + } + + [field: Kept] + [Kept] + [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + public Type Type { get; [Kept] set; } + + [field: Kept] + [Kept] + [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + public string TypeName { get; [Kept] set; } + } + [Kept] class ClassWithKeptPublicConstructor { |