question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unit Test process does not exit

See original GitHub issue

I may have discovered why we see really weird unit test behavior sometimes…

I started using ReSharper’s Unit Test Explorer instead of the one built into VS2022. It reports that the test processes has not exited and offers to kill it:

image

Diving into this, I think I found the culprit, but am not 100% sure yet:

FakeDriver creates a thread in IMainLoopDriver.Setup and this thread never exits:

image

I think we either need a way to have that thread not always be running, or we need to add APIs that enable Application.Shutdown to signal the driver to clean up. Right now MainLoop.Stop is ONLY called from unit tests and even if it were called from elsewhere (e.g. Application.ResetState) it has no API available to signal a IMainLoopDriver implementation to clean up.

I’m looking more at this, but if anyone has a simple suggestion for fixing this I’d love to hear it.

Issue Analytics

  • State:open
  • Created 4 months ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
tigcommented, Jul 12, 2023

@BDisp & @tznind - I was able to get three free ReSharper licenses for this project (via their open source program).

Please let me know if you’d like to start using Resharper. I don’t like a lot of things about it, but their unit Test Explorer is way better than the built-in VS2022 version. I’ll need some way to get you the license info other than GIthub (e.g. email).

0reactions
BDispcommented, Jun 1, 2023

Just to confirm I also see this issue in v2 and I think not just in tests. Lately I have found that I have to exit and restart Visual Studio to make it go away.

This is another issue and I have this issue a lot of times. Mostly when toggle from v2 to v1. The culprit is the VBCSCompiler.exe which sometimes lock the output folder due a failed prior compile. Closing the solution and reopen again may resolve or not. Delete the bin and obj folders may resolve or not. Also happens that restore Visual Studio 2022 doesn’t resolve and many times on after I killed the VBCSCompiler.exe resolves. That a eternal issue that was never be fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to catch a call to exit() (for unit testing)
I want to check in my unit test that it calls exit() when provided with an invalid index. But if I ever give...
Read more >
Jest process doesn't quit after last test completes #1456
I'm having issues with the Jest process not completing after the last test completes. The user will have to force quit the process...
Read more >
all unit tests are finished ,but child process is swamped by ...
This message appears after 1 second after test runner process exits, and only if there still are processes started by the test runner....
Read more >
dotnet test command - .NET CLI
If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1. For...
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found