Rider 2021.3.* hanging in test coverage.

Test coverage consistently hangs (deadlocks?) on two separate computers. I realized one computer has Rider 2021.3.2 and the other has Rider 2021.3.1. It's not always the same tests that it gets stuck on and if I remove the ones it gets stuck on (after restarting Rider) it will get stuck somewhere else instead.Choosing "Run Tests" works fine and everything passes. Choosing "Debug Tests" works fine as well. Only "Cover Tests" causes the hang. Something underneath does not recover from stopping the unit test session and the IDE no longer functions with repeated "Creating Backend Thread Dump" messages every 10 seconds or so.

It does "seem" like it tends to get stuck on Windows Forms related tests and not more "pure" tests, but it's hard to say for sure; there's no indication what it is stuck on or why it is stuck and this only happens for coverage, the tests otherwise pass fine. (So far Run Tests has never hung, and Cover Tests has always hung, as long as I run enough tests. I can cover a single test at a time with no issues, even the ones it was stuck on. This is why it seems like a deadlock or something but who knows.)

0
6 comments

Hello Dave,

In order to investigate the issue we will need some additional information, could you please collect the diagnostic information using the following instruction and full log bundle using the following instructions and attach it with a new issue on our tracker? Thank you in advance!

0

I think there is sensitive information in a dump file. I tried testing it myself and the test happened to crash instead of hang, giving me some exception information. In the test output it said there was a JetBrains "ProcessExitedUnexpectedlyException". There was a message at the bottom referring me to a unit test log file.

Reading the log file I can see that it was attempting to connect a pipe to the process but it wouldn't connect. There are a few lines like this:

11:04:42.890 |I| Could not connect to net.pipe://COMPUTER/TestExecutor/15872 in 00:00:00.0064516. Retrying...

After three tries it seemed to result in this exception:

11:05:00.692 |E| System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult) at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) at JetBrains.Profiler.Windows.RemoteApi.Impl.Version0000.RemoteProfile0000.ProcessAsyncResult(IAsyncResult asyncResult)

Among these lines I also noticed this line:

11:04:43.112 |T| Profiler core connected: Pid=15872, Executable=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.x86.exe, CommandLine="C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.executionengine.x86.exe" /ParentProcessId 10488

This process had gotten stuck earlier, and now I noticed that this was VS 2017 when I am using VS 2019 MSTest. Specifically I am referencing:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll"

for .NET 4.0 unit testing. (I happen to have both VS2017 and VS2019 installed.)

In Rider I went to Settings -> Unit Testing -> MSTest and changed the selected VS directory from the 2017 folder to the 2019 folder and this has corrected the issue.

0

Well, I am still having the same issue on the other computer, and it is not caused by the same thing. On that computer it always hangs on the same test if I test everything, though I can test that test and ones near it with no problem. Same thing too where it only hangs on coverage and not when running (I can run all tests, it only hangs there if I cover all tests).

It is able to properly cancel. In the test log, I can see a time gap between starting the test run and cancelling, with no log messages in between.

11:56:00.303 |T| Profiler: CoreConnected event received: run=70e04e6b-a041-4b4c-ac6b-aceec1c10f86, pid=26176
12:01:21.150 |I| Run: 70e04e6b-a041-4b4c-ac6b-aceec1c10f86 - is being cancelled

There are a bunch of successful runs (one run per test project I think?) before this and they seem to do the same things, so I don't know why it gets stuck.

0

Dave Cousineau, when creating issue you can make your attachments private, make the whole issue private so that only JB representatives could see it. We can also sign NDA if required. In case of crash and stuck process we need to investigate process dump to make any conclusion on what is happening, I sent you instruction how to collect it earlier: How to collect a dump on specific crashed or hanged process.

0

I also just encountered this issue on 2023.2.3 version, and after poking around for quite a while, I found that enabling “Preload Test Runner” is the cause for this issue. After I cleared the check box as in the following screenshot, everything went back to fine. And then I enabled it back, it hangs. 😂

Really hope we could get this bug fixed.

0

Hi Shiwenjie Njust,

Thank you for publishing the workaround. It is indeed an issue our users sporadically face for quite a while. We have recently managed to reproduce it locally (DCVR-12263)  and also hope the fix will not be long in coming. However, we can hardly target the 2023.3 version.

0

Please sign in to leave a comment.