nunit-console icon indicating copy to clipboard operation
nunit-console copied to clipboard

Better handling of FailFast

Open JVimes opened this issue 6 years ago • 4 comments

I'd like to discuss/suggest making the console runner handle FailFast better. FailFast writes an error message to the application event log and immediately kills the agent, so the runner does not receive the message. I see it called in 26 places in the .NET reference source, including in Invariant.Assert, which I ran into in MS production code.

When FailFast is called, the caller just sees NUnitEngineException: Remote test agent exited with non-zero exit code -2146232797 and SocketException : An existing connection was forcibly closed (full output here).

Suggestion: When -2146232797 is encountered, the runner could tell the user to check the application event log. Or the runner could retrieve the error message from the log.

I'm assuming -2146232797 always means FailFast was called. Googling for exit code -2146232797 returns mostly C# compiler bug reports that don't mention FailFast. I was confused and I think other users will be. Thanks to @mikkelbu for letting me know it's associated with FailFast.

JVimes avatar Aug 05 '19 22:08 JVimes

@JVimes I like it - would you be willing to submit a pull request for this?

In terms of implementation, this very similar issue describes how I'd personally go about it: https://github.com/nunit/nunit-console/issues/391

ChrisMaddock avatar Aug 06 '19 07:08 ChrisMaddock

Tagging low priority as this is an uncommon thing to hit, but we'd welcome the contribution none-the-less if you're willing, @JVimes

ChrisMaddock avatar Aug 06 '19 07:08 ChrisMaddock

Thanks, Chris. I'm not invested enough in NUnit at the moment. Should I close this?

JVimes avatar Aug 06 '19 15:08 JVimes

@JVimes Please keep it open, then other people can contribute. Thanks for reporting this.

mikkelbu avatar Aug 06 '19 21:08 mikkelbu