Vstest.console Should not message to Testhost process if it has exited #1994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In very remote cases, esp while debugging if testhost process aborts for some unexpected reeason, & user also triggers a Cancel Request, then sometimes before vstest.console can mark the event testhostexited = true, we get request on another thread to cancel the run.
In this case since the communication with testhost has already expired, we fail to write to the tcp channel, which results in an exception being thrown in vstest.console. This exception is caught, but we also mark current vstest.console session to be completed, & the process dies, this results in further messages from IDE to not execute, for which user has to restart VS.
Bugs:
https://developercommunity.visualstudio.com/content/problem/508748/cant-run-any-test-from-test-explorer-writeandflush.html
https://developercommunity.visualstudio.com/content/problem/532712/occasional-ioexception-while-unit-testing.html
https://developercommunity.visualstudio.com/content/problem/499747/test-execution-fails-with-an-ioexception.html
https://developercommunity.visualstudio.com/content/problem/528897/error-running-unit-test-case.html
Log file:
log.txt