Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test case
  • Loading branch information
AndyAyersMS committed Sep 21, 2022
commit 05957afabb7824365031b169a51736833355f61a
30 changes: 30 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_75828/Runtime_75828.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.InteropServices;

// Verify that the Jit_Patchpoint helper inserted for OSR preserves last error

class Runtime_75828
{
public static int Main()
{
Marshal.SetLastSystemError(42);

int expected = 5_000_000 + 42;

int result = 0;
for (int i = 0; i < 10_000_000; i++)
{
result += i % 2;
}

result += Marshal.GetLastSystemError();

Console.WriteLine($"got {result} expected {expected}");

return result == expected ? 100 : -1;
}
}

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>