-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RemoteExec ignores AV's and CLR crashes #5865
Comments
fyi @stephentoub |
Workaround is to always return an exit code, eg: [Fact]
public static unsafe void FatalError()
{
RemoteExecutor.Invoke(() =>
{
System.Runtime.InteropServices.Marshal.StructureToPtr(1, new IntPtr(1), true); // will AV
return RemoteExecutor.SuccessExitCode;
}).Dispose();
} |
I already did similar fix: #4927 The problem was that async invoke without return value swallows exceptions. The workaround could be same as yours. My personal opinion is to remove CheckExitCode at all and drive the failure by exceptions + process termination. If the test depends on exit code, it would be natural to assert the return value instead let RemoteExecutor do some magic. |
Run tests like this:
result:
Ideally this should detect that the process terminated. In this case, there is no return code. Perhaps, RemoteExec should wrap the test MethodInfo somehow with one that returns 42 (if the invoked method doesn't return a code) and always verify that comes back.
This might mean we could eliminate CheckExitCode, or at least no longer wipe out CheckExitCode when passed an Action<> or Func:
https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutor.cs#L84
The text was updated successfully, but these errors were encountered: