-
Notifications
You must be signed in to change notification settings - Fork 323
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
Testhost stays alive even though KeepAlive=false #4762
Comments
This is a common problem and unfortunately there is nothing we can do about that error. You can try disabling appdomains unless you depend on them. This will get rid of the error and might even make your test run much faster. Here is how: #4726 |
I know that the error is our mistake and caused by our code. Thanks for the hint about disabling appdomains. But that is merely a workaround. This ticket is about the KeepAlive option, my understanding is that the Testhost should exit on encountering the exception because of I only found that vstest/src/vstest.console/Processors/RunTestsArgumentProcessor.cs Lines 168 to 172 in a86e108
|
KeepAlive is for shared testhosts, which is a concept in .NET Framework run where you can isolate the tested dlls from each other using appdomains, so it is also possible to run multiple test runs, using multiple different dlls in the same process, and keep alive is avoiding the overhead of closing and starting a new process when you technically don't need to. https://grep.app/search?q=KeepAlive&filter[repo][0]=microsoft/vstest It should not affect whether or not the testhost stays alive in case of error. When there is appdomain unload failure the process cannot finish, and there is little that we can do, at least not without changing the flow, to kill the process. |
Okay, so I misunderstood what KeepAlive means. Thanks for clearing that up.
Could you expand a little bit on this? Why can't this be changed? |
The current flow does not allow to work around appdomain unloading problems in a reliable way, if you can disable running with appdomains using one of those ways: |
Description
Testhost stays alive indefinitely on a
CannotUnloadAppDomainException
even thoughKeepAlive
isfalse
and therefore vstest.console.exe doesn't exit.Related issue: microsoft/testfx#225
Steps to reproduce
Have tests that causes a
CannotUnloadAppDomainException
on disposing theUnitTestAdapter
and the Testhost just stays alive indefinitely and thereforevstest.console.exe
doesn't exit.Expected behavior
Testhost exits with error on encountering the exception.
Actual behavior
Testhost stays alive indefinitely.
Diagnostic logs
Environment
Windows Server x64
vstest.console.exe, Version: 17.4.1-release-20221129-02 Current process architecture: X64
The text was updated successfully, but these errors were encountered: