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

using System;
using System.Runtime.CompilerServices;
class Program
{
    static int Main()
    {
        try
        {
            Test(null);

            Console.WriteLine("!!!!!!!!!!!!!!!!!  TEST PASSED !!!!!!!!!!!!!!!!!!!!");
            return 100;
        }
        catch (NullReferenceException)
        {
            Console.WriteLine("!!!!!!!!!!!!!!!!!  TEST FAILED !!!!!!!!!!!!!!!!!!!!");
            return 101;
        }
        catch
        {
            Console.WriteLine("!!!!!!!!!!!!!!!!!  TEST FAILED !!!!!!!!!!!!!!!!!!!!");
            Console.WriteLine("Did not even get a NullReferenceException, need to know why!");
            return 666;
        }

    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static void Test(string x)
    {
        for (int i = 0; i < 10; ++i)
        {
            if (String.IsNullOrEmpty(x))
            { }
        }
    }
}