Unloading and Loading DirectRunner causes crash
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 234
- Forks
- 163
- Avg merge
- 13h 32m
- Merged PRs (30d)
- 25
Description
I discovered this while experimenting various ways to handle reloading assemblies in the GUI. The engine supports two approaches: (1) Reload and (2) Unload followed by Load.
If you do an Unload and then Load the same assembly, the calls are allowed. In the case of tests being run in a separate process it works. But if the tests are in the same process an exception is thrown because of trying to access an unloaded AppDomain.
Looking at the code, I think it is because the AppDomain is created in LoadPackage and unloaded in UnloadPackage. However, the creation in LoadPackage is conditioned on no package being already loaded.
In principle, the various runners could work either way. That is, they could allow reuse or not allow it at all. But whichever is chosen, the runners should all work the same regardless of whether the tests are being run in or out of process.
For my own project I'm now trying a different approach but I think this should be fixed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace DirectRunner's LoadPackage and UnloadPackage handling of the AppDomain, especially when unloading and loading the same assembly in-process. Compare the behavior with separate-process execution and the other runners. Done means repeated unload/load works consistently, or is consistently rejected, regardless of process mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100