blob: e3f76779f52de897a45a1a5766392e7d3e32ff3e (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
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 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 []
{
"ldstr",
"newobj",
"throw",
})]
[ExpectedExceptionHandlerSequence (new string[0])]
protected override void OnEventCommand (EventCommandEventArgs command)
{
try {
Removed ();
} catch {
try {
Removed ();
} catch {
Removed ();
throw;
}
throw;
}
}
[Kept]
[ExpectedInstructionSequence (new []
{
"ldstr",
"newobj",
"throw",
})]
[Event (8)]
public void SomeMethod ()
{
Removed ();
}
public void Removed ()
{
}
}
}
|