Skip to content

Commit

Permalink
Don't rely on error code returned on Windows Nano (dotnet#104973)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik committed Jul 17, 2024
1 parent acfb801 commit bbcab23
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1267,13 +1267,13 @@ public void StartInfo_BadExe(bool useShellExecute)
FileName = tempFile
};

int expected = ERROR_BAD_EXE_FORMAT;

// Windows Nano bug see https://github.com/dotnet/runtime/issues/17919
if (PlatformDetection.IsWindowsNanoServer)
expected = ERROR_SUCCESS;

Assert.Equal(expected, Assert.Throws<Win32Exception>(() => Process.Start(info)).NativeErrorCode);
int errorCode = Assert.Throws<Win32Exception>(() => Process.Start(info)).NativeErrorCode;
if (!PlatformDetection.IsWindowsNanoServer)
{
// We can not rely on the error code returned on Windows Nano https://github.com/dotnet/runtime/issues/17919
Assert.Equal(ERROR_BAD_EXE_FORMAT, errorCode);
}
}

[Fact]
Expand Down

0 comments on commit bbcab23

Please sign in to comment.