forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4973c82
commit 15231fb
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Runtime.CompilerServices; | ||
|
||
public class Runtime_63905 | ||
{ | ||
public static int Main() | ||
{ | ||
C c = GetNull(); | ||
int i = GetOne(); | ||
try | ||
{ | ||
Foo(c.Field, i / 0); | ||
} | ||
catch (NullReferenceException) | ||
{ | ||
Console.WriteLine("PASS: Caught NullReferenceException in first argument"); | ||
return 100; | ||
} | ||
catch (DivideByZeroException) | ||
{ | ||
Console.WriteLine("FAIL: Arguments were reordered incorrectly"); | ||
return -1; | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static C GetNull() => null; | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static int GetOne() => 1; | ||
|
||
[MethodImpl(MethodImplOptions.NoInlining)] | ||
private static void Foo(object o, int val) | ||
{ | ||
} | ||
|
||
private class C | ||
{ | ||
public object Field; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<Optimize>True</Optimize> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |