Welcome to mirror list, hosted at ThFree Co, Russian Federation.

NonEventWithLog.cs « ETW « BCLFeatures « Mono.Linker.Tests.Cases « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5b0b82f18ac3cbb24f6c8536a289c04cd0de2cdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 {
	[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 []
		{
			"ldstr",
			"newobj",
			"throw",
		})]
		private void Test2 ()
		{
			Console.WriteLine ();
		}

		[NonEvent]
		private void Test3 ()
		{
			Console.WriteLine ();
		}
	}
}