diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs new file mode 100644 index 000000000..9683563f9 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Attributes/Csc/OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod.cs @@ -0,0 +1,36 @@ +using Mono.Linker.Tests.Cases.Attributes.Dependencies; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +[assembly: KeptAttributeAttribute (typeof (System.Diagnostics.DebuggableAttribute))] + +namespace Mono.Linker.Tests.Cases.Attributes.Csc { + /// <summary> + /// This explicit csc test exists to ensure that csc adds references in this scenario + /// </summary> + [SetupCSharpCompilerToUse ("csc")] + [SetupCompileBefore ("LibraryWithType.dll", new [] { typeof(TypeDefinedInReference) })] + [SetupCompileBefore ("LibraryWithAttribute.dll", new [] { typeof(AttributeDefinedInReference) })] + [KeptTypeInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference))] + [RemovedMemberInAssembly ("LibraryWithType.dll", typeof (TypeDefinedInReference), "Unused()")] + [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), ".ctor()")] + [KeptMemberInAssembly ("LibraryWithAttribute.dll", typeof (AttributeDefinedInReference), "set_PropertyType(System.Type)")] + public class OnlyTypeUsedInAssemblyIsTypeOnAttributePropertyOnMethod { + public static void Main () + { + var foo = new Foo (); + foo.Method (); + } + + [Kept] + [KeptMember (".ctor()")] + class Foo { + [Kept] + [KeptAttributeAttribute (typeof (AttributeDefinedInReference))] + [AttributeDefinedInReference (PropertyType = typeof (TypeDefinedInReference))] + public void Method () + { + } + } + } +}
\ No newline at end of file |