all unit tests are finished ,but child process is swamped by the test runner process are still running.Terminate child process?

Whenever i will try to run Integration test cases getting this error and the test  cases are not running.Visual Studio - VS Professional 2019(Version 16.3.10)

and resharper - 2019.2.2

4
24 comments

Hello,

 

Could you please try installing ReSharper 2019.2.3 and check the issue once again?

Thank you.

0

Hey ,i am  already on ReSharper 2019.2.3 version and still facing the same issue that whenever i will try to run integration test cases it will be running and running.

0

Hello, 

 

Sorry for delay in responding.

Actually this message appears when all tests have passed, but test runner is still running, which is likely because of some tear down code inside the tests we cannot track. This message appears after 1 second after test runner process exits, and only if there still are processes started by the test runner. By this time no user code should normally be running, so no code can terminate the processes. And in some circumstances present of running child processes prevents unit test session from completing the run. Hence this message. Are you sure you don't have orphaned running processes?

Thank you.

0

I am also getting this message tonight for the first time immediately after I updated ReSharper to version 2020.2. This happens in both xUnit and NUnit tests which have been running with ReSharper for several months without issues. It happens after all tests are completed, whether they have passed or not.

2

Same here.
Issue started to appear since we updated to 2020.2.
2020.2.1 did not solve the issue.

0

Hello everyone! Please take a look at the following comments to help you understand why this message appears:

https://youtrack.jetbrains.com/issue/RIDER-49332#focus=Comments-27-4354352.0-0

And a good comment from our user:

https://youtrack.jetbrains.com/issue/RIDER-49584#focus=Comments-27-4356736.0-0

But we will think about how to improve this experience anyway. You can comment/vote on any of these tickets to stay informed about status changes. Thank you!

1

I'm not using Rider, I'm using VS 2019, and don't know what the hell that explanation means. The fact is, this was all working fine until I updated, so you broke this, not my IDE.

0

Thing is: I still have the same issue as soon as I have any test with a Theory using ClassData (in this case of IEnumerable<object[]>).

Even if this test is just Assert.True(true), it hangs with the same error message.

Any advice?

0

ataraxia89 it looks like there are still running child processes in your case that prevent the unit test session from completing execution. This behavior is also relevant for the ReSharper, it'll be improved in 2020.2.2.

@Roman-alexis Anastasini, do you have a chance to send us a sample solution for deeper investigation? It would be very helpful. You can do it via 'Submit a request' form, please add a link to this thread discussion in request details.

0

In my case this is happening because I'm using the sqllocaldb to run integration tests and the testrunner must start the local db but doesn't stop it/shut it down after the tests finished. ReSharper / Rider 2020.2.4

1

Ha! I found the solution to our proboem. And it might actually fix Robbi's issue as well.

We are using a WebapplicationFactory which is initialized within the test class constructor.

_appFactory = WebApplicationFactory();

But: WebapplicationFactory is implementing IDisposable.

Our test class wasn't.

Making the test class itself implement IDisposable and calling _appFactory.Dispose() in the test classes Dispose method did the trick.

Hope that helps!

0

Thanks Robbi! You got me on the right track: Indeed, I can see that a "SQL Server Windows NT - 64 Bit" child process is launched.

If I just kill it just after the test passes and before the message box appears, the message box does not show up at all.

So it would be really really nice if resharper could just ignore this process.

We have 1.5K integration tests and it is just not feasible to hit "ok - kill child process" after every test run!

The following GIF video shows the problem:

The following GIF video shows how killing the process of sqllocaldb "solves" the issue.

I'd rather not kill that process, as it should be re-used by multiple test fixtures running in parallel!

1

Note, as you obviously could work around this by installing MSSQL Express, this is not favored by me as it will run and consume system resources all the time.

I came up using a SQL Server docker image running on docker for windows. (Since WSL2 support is here, it is quite fast)

1. Create a file "docker-compose yml" that contains the following

```yaml

version: "3.7"

services:
mssql:
# see: https://docs.docker.com/compose/aspnet-mssql-compose/
image: "mcr.microsoft.com/mssql/server"
environment:
ACCEPT_EULA: Y
SA_PASSWORD: Secr3T!!!
ports:
- 1444:1433

```

2. change the connection string of your tests to point to this instance

```xml

<connectionStrings>
<add name="Default" connectionString="Data Source=127.0.0.1,1444; Initial Catalog={0};User Id=SA;Password=Secr3T!!!" providerName="System.Data.SqlClient"/>
</connectionStrings>

```

3. before running tests, open cmd prompt in the folder where you store your docker-compose.yml and run `docker-compose up' 

Note. You can also run it in the background using `docker-compose up -d` but then you may forget to shut it down and it will keep on using your system resources

4. finally you can run your tests

 

I hope this helps anybody!

0

We used the following solution to close the LocalDB process after running all tests (NUnit)

    [SetUpFixture]
public class AssemblyInitialize
{
[OneTimeTearDown]
public void RunAfterAllTests()
{
// Don't leave LocalDB process running (fix test runner warning)
using var process = Process.Start("sqllocaldb", "stop MSSQLLocalDB");
process.WaitForExit();
}
}
1

Well... this may work if you have a single fixture.

But we do not have all our 1.000+ integration tests in just one fixture :-|

0

I edited the code above to include SetUpFixture

0
Avatar
Permanently deleted user

Arni Leibovits `Process.Start` returns a `Process` type which inherits from `IDisposable`. You really should wrap that block in a using statement.

[SetUpFixture]
public class AssemblyInitialize
{
[OneTimeTearDown]
public void RunAfterAllTests()
{
// Don't leave LocalDB process running (fix test runner warning)
using (var process = Process.Start("sqllocaldb", "stop MSSQLLocalDB"))
{
process.WaitForExit();
}
}
}
0

@... Theoretically, you are correct. I edited my code above.

0

Try run tests using VS standard test explorer. In my case, it gave me the exact stack trace to the real issue in the code. It was an exception during disposal of the very unrelated object. But still, it was the cause.

0

After implementing 5 unit tests using MSFakes, I got the same message by launching tests with dotcover,

I got this message and no result from dotcover...

All works fine before (or if I bypass those tests by commenting them) I use VS2019 and R# 2020.x and NUnit v3

PS : I uncheck the tick in option "Check for orphan process spawned by test runner" but still no result in dotcover

 

0
Avatar
Permanently deleted user

Cyril035 AFAIK Fakes and Shims from Visual Studio is usable/runnable only from Test Explorer and the Microsoft stack of testing tools. I don't believe you can use third party products and tools to work with F&S.

Good luck.

edit: My comment was wrong. Other commenters provided updates later in the thread.

0

@Ryan Rodemoyer, all tests passed launching them from a normal run with R#.. launching them with dotcover has different behavior..

0

@Cyril035 same here normal test run, runs fine from Resharper. But when trying it from dotCover the message appears and the code coverage isn't done.

With Resharper 2019.1 it worked fine.

0

MSFakes and Mock Frameworks are fully supported by ReSharper and dotCover since 2020.2 version.

If you encounter any unexpected behaviour, do not hesitate to submit a support ticket. Thank you!

0

Please sign in to leave a comment.