`--exclude-feature` logic was removed. If there is no intent to support this with coreclr bcl then we won't worry about it either.
While we do need UnityLinker to continue to handle mono class libraries for awhile longer, the `--exclude-feature` functionality is a niche thing we can drop now.
protected override string TestSuiteName => "BCLFeatures.ETW";
[Fact]
- public Task BaseRemovedEventSource ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
- [Fact]
- public Task BaseRemovedEventSourceEmptyBody ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
- [Fact]
- public Task BaseRemovedEventSourceNonVoidReturn ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
- [Fact]
public Task CustomEventSource ()
{
return RunTest (allowMissingWarnings: true);
return RunTest (allowMissingWarnings: true);
}
- [Fact]
- public Task Excluded ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
- [Fact]
- public Task LocalsOfModifiedMethodAreRemoved ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
- [Fact]
- public Task NonEventWithLog ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
- [Fact]
- public Task StubbedMethodWithExceptionHandlers ()
- {
- return RunTest (allowMissingWarnings: true);
- }
-
}
}
\ No newline at end of file
+++ /dev/null
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Keep framework code that calls EventSource methods like OnEventCommand
- [SetupLinkerTrimMode ("skip")]
- public class BaseRemovedEventSource
- {
- public static void Main ()
- {
- var b = CustomCtorEventSource.Log.IsEnabled ();
- if (b)
- CustomCtorEventSource.Log.SomeMethod ();
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
- [KeptMember (".cctor()")]
- [EventSource (Name = "MyCompany")]
- class CustomCtorEventSource : EventSource
- {
- public class Keywords
- {
- public const EventKeywords Page = (EventKeywords) 1;
-
- public int Unused;
- }
-
- [Kept]
- public static CustomCtorEventSource Log = new MyEventSourceBasedOnCustomCtorEventSource (1);
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ldarg.0",
- "call",
- "ret",
- })]
- public CustomCtorEventSource (int value)
- {
- Removed ();
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret",
- })]
- protected override void OnEventCommand (EventCommandEventArgs command)
- {
- Removed2 ();
- }
-
- static void Removed2 ()
- {
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret",
- })]
- [Event (8)]
- public void SomeMethod ()
- {
- Removed ();
- }
-
- public void Removed ()
- {
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (CustomCtorEventSource))]
- class MyEventSourceBasedOnCustomCtorEventSource : CustomCtorEventSource
- {
- [Kept]
- public MyEventSourceBasedOnCustomCtorEventSource (int value) : base (value)
- {
- }
- }
-}
+++ /dev/null
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Keep framework code that calls EventSource methods like OnEventCommand
- [SetupLinkerTrimMode ("skip")]
- public class BaseRemovedEventSourceEmptyBody
- {
- public static void Main ()
- {
- var b = CustomCtorEventSourceEmptyBody.Log.IsEnabled ();
- if (b)
- CustomCtorEventSourceEmptyBody.Log.SomeMethod ();
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
- [KeptMember (".cctor()")]
- [EventSource (Name = "MyCompany")]
- class CustomCtorEventSourceEmptyBody : EventSource
- {
- public class Keywords
- {
- public const EventKeywords Page = (EventKeywords) 1;
-
- public int Unused;
- }
-
- [Kept]
- public static CustomCtorEventSourceEmptyBody Log = new MyEventSourceBasedOnCustomCtorEventSourceEmptyBody (1);
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ldarg.0",
- "call",
- "ret",
- })]
- public CustomCtorEventSourceEmptyBody (int value)
- {
- Removed ();
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret"
- })]
- protected override void OnEventCommand (EventCommandEventArgs command)
- {
- // A nop is removed
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret"
- })]
- [Event (8)]
- public void SomeMethod ()
- {
- Removed ();
- }
-
- public void Removed ()
- {
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (CustomCtorEventSourceEmptyBody))]
- class MyEventSourceBasedOnCustomCtorEventSourceEmptyBody : CustomCtorEventSourceEmptyBody
- {
- [Kept]
- public MyEventSourceBasedOnCustomCtorEventSourceEmptyBody (int value) : base (value)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Keep framework code that calls EventSource methods like OnEventCommand
- [SetupLinkerTrimMode ("skip")]
- public class BaseRemovedEventSourceNonVoidReturn
- {
- public static void Main ()
- {
- var b = CustomCtorEventSourceNonVoidReturn.Log.IsEnabled ();
- if (b)
- CustomCtorEventSourceNonVoidReturn.Log.SomeMethod ();
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
- [KeptMember (".cctor()")]
- [EventSource (Name = "MyCompany")]
- class CustomCtorEventSourceNonVoidReturn : EventSource
- {
- public class Keywords
- {
- public const EventKeywords Page = (EventKeywords) 1;
-
- public int Unused;
- }
-
- [Kept]
- public static CustomCtorEventSourceNonVoidReturn Log = new MyEventSourceBasedOnCustomCtorEventSourceNonVoidReturn (1);
-
- [Kept]
- [ExpectedInstructionSequence (new[] { "ldarg.0", "call", "ret", })]
- public CustomCtorEventSourceNonVoidReturn (int value)
- {
- Removed ();
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[] { "ldstr", "newobj", "throw" })]
- [ExpectLocalsModified]
- [Event (8)]
- public int SomeMethod ()
- {
- return Removed ();
- }
-
- public int Removed ()
- {
- return 0;
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (CustomCtorEventSourceNonVoidReturn))]
- class MyEventSourceBasedOnCustomCtorEventSourceNonVoidReturn : CustomCtorEventSourceNonVoidReturn
- {
- [Kept]
- public MyEventSourceBasedOnCustomCtorEventSourceNonVoidReturn (int value) : base (value)
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Keep framework code that calls EventSource methods like OnEventCommand
- [SetupLinkerTrimMode ("skip")]
- // Used to avoid different compilers generating different IL which can mess up the instruction asserts
- [SetupCompileArgument ("/optimize+")]
- public class Excluded
- {
- public static void Main ()
- {
- var b = RemovedEventSource.Log.IsEnabled ();
- if (b)
- RemovedEventSource.Log.SomeMethod ();
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
- [KeptMember (".cctor()")]
- [EventSource (Name = "MyCompany")]
- class RemovedEventSource : EventSource
- {
- public class Keywords
- {
- public const EventKeywords Page = (EventKeywords) 1;
-
- public int Unused;
- }
-
- [Kept]
- public static RemovedEventSource Log = new RemovedEventSource ();
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret",
- })]
- protected override void OnEventCommand (EventCommandEventArgs command)
- {
- Removed2 ();
- }
-
- static void Removed2 ()
- {
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret",
- })]
- [Event (8)]
- public void SomeMethod ()
- {
- Removed ();
- }
-
- public void Removed ()
- {
- }
- }
-}
+++ /dev/null
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Keep framework code that calls EventSource methods like OnEventCommand
- [SetupLinkerTrimMode ("skip")]
- // Used to avoid different compilers generating different IL which can mess up the instruction asserts
- [SetupCompileArgument ("/optimize+")]
- public class LocalsOfModifiedMethodAreRemoved
- {
- public static void Main ()
- {
- var b = LocalsAreCleared_RemovedEventSource.Log.IsEnabled ();
- if (b)
- LocalsAreCleared_RemovedEventSource.Log.SomeMethod ();
- }
-
- public class ClassForLocal
- {
- }
-
- public static void CallsToForceALocal (int arg1, int arg2, int arg3)
- {
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
- [KeptMember (".cctor()")]
- [EventSource (Name = "MyCompany")]
- class LocalsAreCleared_RemovedEventSource : EventSource
- {
- public class Keywords
- {
- public const EventKeywords Page = (EventKeywords) 1;
-
- public int Unused;
- }
-
- [Kept]
- public static LocalsAreCleared_RemovedEventSource Log = new LocalsAreCleared_RemovedEventSource ();
-
- [Kept]
- [ExpectBodyModified]
- [ExpectedLocalsSequence (new string[0])]
- protected override void OnEventCommand (EventCommandEventArgs command)
- {
- // Do some extra stuff to be extra certain the compiler introduced a local instead of using `dup`
- var tmp = new LocalsOfModifiedMethodAreRemoved.ClassForLocal ();
- LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, 3, 4);
- LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, 4, 4);
- var hashcode = tmp.GetHashCode ();
- LocalsOfModifiedMethodAreRemoved.CallsToForceALocal (1, hashcode, 3);
- }
-
- [Kept]
- [Event (8)]
- [ExpectBodyModified]
- public void SomeMethod ()
- {
- Removed ();
- }
-
- public void Removed ()
- {
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Used to avoid different compilers generating different IL which can mess up the instruction asserts
- [SetupCompileArgument ("/optimize+")]
- public class NonEventWithLog
- {
- public static void Main ()
- {
- var n = new NonEventWithLogSource ();
- n.Test1 ();
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
-
- [EventSource (Name = "MyCompany")]
- class NonEventWithLogSource : EventSource
- {
-
- [NonEvent]
- [Kept]
- internal void Test1 ()
- {
- if (IsEnabled ())
- Test2 ();
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret"
- })]
- private void Test2 ()
- {
- Console.WriteLine ();
- }
-
- [NonEvent]
- private void Test3 ()
- {
- Console.WriteLine ();
- }
- }
-}
+++ /dev/null
-using System.Diagnostics.Tracing;
-using Mono.Linker.Tests.Cases.Expectations.Assertions;
-using Mono.Linker.Tests.Cases.Expectations.Metadata;
-
-namespace Mono.Linker.Tests.Cases.BCLFeatures.ETW
-{
- [TestCaseRequirements (TestRunCharacteristics.TargetingNetFramework, "--exclude-feature is not supported on .NET Core")]
- [SetupLinkerArgument ("--exclude-feature", "etw")]
- // Keep framework code that calls EventSource methods like OnEventCommand
- [SetupLinkerTrimMode ("skip")]
- // Used to avoid different compilers generating different IL which can mess up the instruction asserts
- [SetupCompileArgument ("/optimize+")]
- public class StubbedMethodWithExceptionHandlers
- {
- public static void Main ()
- {
- var b = StubbedMethodWithExceptionHandlers_RemovedEventSource.Log.IsEnabled ();
- if (b)
- StubbedMethodWithExceptionHandlers_RemovedEventSource.Log.SomeMethod ();
- }
- }
-
- [Kept]
- [KeptBaseType (typeof (EventSource))]
- [KeptMember (".ctor()")]
- [KeptMember (".cctor()")]
- [EventSource (Name = "MyCompany")]
- class StubbedMethodWithExceptionHandlers_RemovedEventSource : EventSource
- {
- public class Keywords
- {
- public const EventKeywords Page = (EventKeywords) 1;
-
- public int Unused;
- }
-
- [Kept]
- public static StubbedMethodWithExceptionHandlers_RemovedEventSource Log = new StubbedMethodWithExceptionHandlers_RemovedEventSource ();
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret"
- })]
- protected override void OnEventCommand (EventCommandEventArgs command)
- {
- try {
- Removed ();
- } catch {
- try {
- Removed ();
- } catch {
- Removed ();
- throw;
- }
- throw;
- }
- }
-
- [Kept]
- [ExpectedInstructionSequence (new[]
- {
- "ret"
- })]
- [Event (8)]
- public void SomeMethod ()
- {
- Removed ();
- }
-
- public void Removed ()
- {
- }
- }
-}
\ No newline at end of file