ITestExecutor Cancel does not appear to be called
Description
The Cancel method of an ITestExecutor does not appear to be called
Steps to reproduce
Create an implementation of ITestExecuter Create a long running test that test executer would execute Run a the long running test Hit the cancel button in the text explorer
Expected behavior
Cancel method is invoke
Actual behavior
Nothing
Diagnostic logs
Environment
Visual Studio 2022 Version 17.5.0
I run into the same issue public void Cancel() is not called when pressing the stop button on Test Explorer
But on console it shows
========== Test run aborted: 1 Tests (1 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========
This is by-design (or rather: too late to change it now).
You're not serious now, are you?
The ITestExecutor is an official interface and should be supported by default!
https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/ITestExecutor.cs
The answer is probably below par ...
I am not, this was done to keep the interactive experience in VS responsive. When abort is pressed everything tears down as fast as possible.
The problem is that if a test hangs for some unknown reason, it must be possible to cancel the test execution. Otherwise, this would mean I would have to close and reopen the IDE to solve the problem, which is very inconvenient.