Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbotsch committed Jun 17, 2022
1 parent 4973c82 commit 15231fb
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.cs
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;
}
}
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>

0 comments on commit 15231fb

Please sign in to comment.