diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs new file mode 100644 index 000000000..0df1c12e5 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Attributes/Mcs/OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent.cs @@ -0,0 +1,43 @@ +using System; +using Mono.Linker.Tests.Cases.Attributes.Dependencies; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.Attributes.Mcs { + /// <summary> + /// This explicit mcs test exists because mcs did not add a reference prior to https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5 + /// </summary> + [IgnoreTestCase ("Can be enabled once the mcs contains https://github.com/mono/mono/commit/f71b208ca7b41a2a97ca70b955df0c4c411ce8e5")] + [SetupCSharpCompilerToUse ("mcs")] + [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(System.Type)")] + [KeptDelegateCacheField ("0")] + public class OnlyTypeUsedInAssemblyIsTypeOnAttributeCtorOnEvent { + public static void Main () + { + var foo = new Foo (); + foo.MyEvent += FooOnMyEvent; + } + + [Kept] + private static void FooOnMyEvent (object sender, EventArgs e) + { + } + + [Kept] + [KeptMember (".ctor()")] + class Foo + { + [Kept] + [KeptBackingField] + [KeptEventAddMethod] + [KeptEventRemoveMethod] + [KeptAttributeAttribute (typeof( AttributeDefinedInReference))] + [AttributeDefinedInReference (typeof (TypeDefinedInReference))] + public event EventHandler MyEvent; + } + } +}
\ No newline at end of file |