summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/CLR-x86-JIT/v2.1/DDB/b158861/b158861.cs
blob: 39d2394ff80e49fdee10926b60e6c5ab34ea7853 (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
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

//Disable tailcall if the caller is marked no-inline.
//Test expects Foo() to catch the exception thrown by Bar(). 
using System;
using System.Runtime.CompilerServices;

public class My
{

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    static void bar()
    {
        throw new Exception();
    }

    [MethodImplAttribute(MethodImplOptions.NoInlining)]
    static int foo()
    {
        try
        {
            bar();
            return 201;
        }
        catch (System.Exception)
        {
            return 100;
        }
    }

    static int Main()
    {
        try
        {
            return foo();

        }
        catch (System.Exception e)
        {
            Console.WriteLine(e);
            return 101;
        }

    }

}