summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Directed/coverage/importer/nullsdarr.il
blob: d354d372372b9f9b7e8271884360d2f9b17795d5 (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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

.assembly extern legacy library mscorlib {}
.assembly extern System.Console
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
  .ver 4:0:0:0
}
.assembly legacy library arrlen {}
.class private auto ansi beforefieldinit nullsdarr
       extends [mscorlib]System.Object
{
  .method public static void f() cil managed
  {
    .maxstack  1
    IL_0000:  ldnull
    IL_0003:  ldlen
    IL_0004:  conv.i4
    IL_0005:  call       void [System.Console]System.Console::WriteLine(int32)
    IL_0010:  ret
  }
  .method public static int32 Main() cil managed
  {
    .entrypoint
    .maxstack 5
    .try
    {
	call void nullsdarr::f()
        leave.s FAIL
    }
    catch [mscorlib]System.NullReferenceException
    {
        pop
        leave.s PASS
    }
    FAIL:
	ldstr "Should have caught System.NullReferenceException"
	call void [System.Console]System.Console::WriteLine(string)
	ldstr "FAILED"
	call void [System.Console]System.Console::WriteLine(string)
        ldc.i4 1
	ret
    PASS:
	ldstr "Caught System.NullReferenceException as expected"
	call void [System.Console]System.Console::WriteLine(string)
	ldstr "PASSED"
	call void [System.Console]System.Console::WriteLine(string)
        ldc.i4 100
	ret
  }
}