Unit Test Session hangs

Hello,

 

I've had this problem now for a few months where my  Unit Test Session hangs quite often. It's like it starts preparing to run but never actually starts running the tests. Whenever this happens the only thing I can do is close Visual Studio and restart it again. Typically it happens several times every day. 

Closing the test session and starting a new one doesn't help. Same problem happens on both VS 2015 and 2017.

 

6
24 comments

Hello Martin!

 

Thank you for the feedback.

Could you please specify the following:

  • which test framework is used in the project in question;
  • what kind of the project it is (Core/.NET Framework, what version etc).

 

Please also try the latest R# 2017.3 EAP build - https://www.jetbrains.com/resharper/eap/ and check if the problem persists.

Thank you.

0
Avatar
Permanently deleted user

Hello,

 

Same issue here. It's really blocking as it takes minutes to recover. So most of the time I kill VS and restart my project.

 

I use the following frameworks:

- xunit

- selenium

 

it's a .net project version 4.5.2

 

I hope you will be able to support us quickly.

 

Best Regards,

Nicolas

0

Same here. MSTest / Selenium, .NET 4.5.2, R# 2018.1.4

0

Hello Marcel!

 

If you also get hanging VS when trying to run test could you please collect dump as described in the following [article] (https://resharper-support.jetbrains.com/hc/en-us/articles/206546619-What-to-do-if-Visual-Studio-with-ReSharper-hangs-completely-). You can send dump privately via 'Submit a request' form, please specify link to this forum thread in request details.

Thanks in advance.

0
Hi Angelina,
 
It's not VS that's hanging, just the unit test session. It shows a watch icon and doesn't do anything from there... and hitting the stop icon (the red square) enters another state where a scroll bar gets animated but nothing actually happens.
 
The rest of VS works just fine, I can modify and compile the code, I just can't run tests anymore. (Not with the R# unit test runner anyway, I don't remember if I tried the VS Test Explorer.)
0

Thank you  for the reply, Marcel.

 

Could you please run Visual Studio with the following command line: 'devenv /ReSharper.LogFile C:\resharper_log.txt /ReSharper.LogLevel Verbose', reproduce the issue and send us a corresponding 'resharper_log.txt' file. You can do it privately via 'Submit a request' form.

Thank you.

0

Having the same/similar problem.  My issue arises when I attempt to cover certain test groups that have a failed test.  I've submitted a request and included the log file generated as requested above. 

Request #2070753 with attachments

0
Avatar
Permanently deleted user

Seems it happens with xunit and [Theory] tests, when type of InlineData parameter is enum.

0

Hello Fadeevas!

 

Thank you for the feedback.

What behavior do you experience: hanging, some test run issue or something else?

Could you please provide some code sample demonstrating the problem?

Thank you.

0
Avatar
Permanently deleted user

Can I write in Russian?

0

Hello Fadeevas!

 

Yep, you can. I'd only suggest to use "Submit a request" form at the top of the page.

Thank you.

0
Avatar
Permanently deleted user

I am having the same issue. I found a way to recover more quickly:

I'm using 'ReSharper Build' (instead of 'VS build'). When I get stuck, I switch to VS build and back to ReSharper Build and I'm unstuck. Takes seconds rather than minutes.

Hope the issue is solved soon, though - seconds wasted is still annoying.

0

I am having exactly the same issue and it is extremely annoying as the only work around I have is to close and re-open VS which takes ages (~20 sec each time).

I tried suggestions from https://stackoverflow.com/questions/29613661/resharper-unit-tests-not-running:

1) clearing cache did not help

2) Resharper_Suspend just crashes my VisualStudio altogether - did not help

 

I run:

" & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe" /ReSharper.LogFile C:\resharper_log.txt /ReSharper.LogLevel Verbose"

as per this suggestion. I am using GoogleTest framework in cpp code. The hang occurs if I stop debugging/error occurs and the Resharped Unit TestExplorer does not realise the execution of the test has ended and it hangs. When tried to abort (press the stop/abort button) nothing happens.

Here is the report log from one of the bug occurrances:

https://drive.google.com/drive/folders/1M8WzFfClb-iA1gHOYakFd3_0btP3ZOsx?usp=sharing

Please please help me find the solution to this, I cannot be restarting my VS every time I debug my code and I hit an error.

Cheers!

0

The same problem while trying to profile NUnit test with:

VS 2019

JetBrains ReSharper Ultimate 2020.1.4 Build 201.0.20200702.125931 built on 2020-07-02
dotCover 2020.1.20200703.51343
dotTrace 2020.1.20200703.51429
ReSharper 2020.1.20200702.133401

 

Suspicious lines from verbose log file:

--- EXCEPTION #1/2 [NullReferenceException]
Message = “Object reference not set to an instance of an object.”
ExceptionPath = Root.InnerException
ClassName = System.NullReferenceException
HResult = E_POINTER=COR_E_NULLREFERENCE=80004003
Source = JetBrains.Profiler.Editor.Windows.BehaviorModel
StackTraceString = “
at JetBrains.Profiler.Editor.Windows.BehaviorModel.Argument.Impl.CommandLineBehaviorFeature.ValidateFileAdapter(IProperty`1 host, String x)
at JetBrains.Profiler.Editor.Windows.BehaviorModel.Argument.Impl.CommandLineBehaviorFeature.<>c__DisplayClass6_0.<.ctor>b__3(String x)
at JetBrains.Profiler.Editor.Windows.BehaviorModel.Impl.BehaviorModelUtil.<>c__DisplayClass25_2`1.<CreateStatusPropertyAsync>b__3()
at JetBrains.Util.Logging.Logger.CatchSilent[TValue](Func`1 func, TValue defaultValue)

--- Outer ---

--- EXCEPTION #2/2 [LoggerException]
Message = “Object reference not set to an instance of an object.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = “Exception #1 at Root.InnerException”
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
at JetBrains.Profiler.Editor.Windows.BehaviorModel.Impl.BehaviorModelUtil.<>c__DisplayClass25_1`1.<CreateStatusPropertyAsync>b__2()
at JetBrains.Util.Logging.Logger.Catch(Action action)
at JetBrains.Threading.ThreadManager.<>c__DisplayClass13_0.<RunSafe>b__0(Object _)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

 

0

Hello Gooshift,

 

Could you please try the latest ReSharper 2020.2 EAP build and check the issue once again - https://www.jetbrains.com/resharper/nextversion/

Please let me know about the results.

Thank you.

0

Hello Angelina,

Just tried but nothing changed - same problem persists. Would you like me to provide more data?

0

Olga Diakonova - why new issue? I attached a log above with my comment, surely that should be sufficient, please follow the link, should be accessible to anyone. Cheers.

0

Patrycja Szelag, in your log I can see you are running ReSharper 2019.2.3, would you mind checking the latest available R# 20.2 and let us know if the issue is the same there?

0

OK, steps I performed:

1) upgraded my resharper to 2020.20.1 built on 2020-08-20

2) run in powershell command (admin mode on):

"& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe" /ReSharper.LogFile C:\resharper_log_2020_08_21.txt /ReSharper.LogLevel Verbose"

3) opened my project solution, built it

4) run one of the tests in Debug mode with breakpoint in, stopped the execution of the test by pressing "stop" button (without waiting for it to run to the end and finalize)

5) observed the test status still spinning, regardless trying to stop it from within UnitTestSession by pressing another "stop" button (which changes to "abort" button, which I pressed and it did not help either)

6) tried to close Visual Studio (VS) by pressing "close" button on the top, but it just made it hang

7) I killed VS from within Task Manager

8) could not find C:\resharper_log_2020_08_21.txt, so I created an empty file with that name and re-run steps 2-4

9) this time the test stopped executing and the solution on close did not hang, but the C:\resharper_log_2020_08_21.txt ramained empty.

Bizzare.

So, I read the https://www.jetbrains.com/help/resharper/Introduction__Troubleshooting.html?_ga=2.190108268.677396598.1598014646-1362727825.1597824291#logs and have noticed that you store them in default location "%TEMP%\JetLogs"

10) went there and noticed some logs, uploaded now for you in: 

https://drive.google.com/drive/folders/1iQX7KKduxxdwNxTi8Rnu83kE-nOOVFmV?usp=sharing 

 

Summary:

1) It seems it hanged once only after the upgrade, then it did not happen again. I will keep an eye this issue though and if I manage to repo will feedback again.

Please, let me know if you find something in either of the logs (previous one and these ones).

2) Although I found another bug, not sure whether it is JetBrains or Microsoft, the devenv.exe with path-to-report does not work.

Cheers!

0

Hello Patrycja,

 

Unfortunately, logs don't contain any info about VS hanging.

If you manage again to reproduce the issue could you please collect a dump for us as described in the following help article - https://resharper-support.jetbrains.com/hc/en-us/articles/206546619.

Logs most probably were not created as there are no rights in writing in C: root. You may try some folder like C:\log\ next time to collect a log.

Thank you.

0

This problem still exists in the latest version.

The underlying problem is that ReSharper somehow persists test sessions or test metadata outside what is visible to the user. You can close a test session and create a new one using "Run all tests from solution". You can even explicitly delete tests, restart Visual Studio, etc., but some broken tests that cause ReSharper to hang will just come back again.

Whatever ReSharper stores, and where it is stored, it is difficult to find out where it is, and there is no option in the UI to purge this storage and force ReSharper to re-discover all tests again from code without any garbage from previous sessions. Please add this feature, so we at least have a workaround for this problem.

0

It seems that there already is a function to clear caches in ReSharper, and in my case it did work:
https://www.jetbrains.com/help/resharper/Configuring_Caches_Location.html#cleanup

So at least there is a workaround.

It would be good if there was a more direct and easier to find way to really rebuild an entire unit test session from scratch, as part of the test runner UI. The current UI is misleading, as it pretends it can do so, but actually doesn't, because of obscure caches that you need to know about.

0

Hello Florian Winter,

In ReSharper, if you need to discard some of the cached information, you can Shift+left click Refresh in the Unit Test Explorer, it will clear unit test tree and discovery results before restarting test discovery. 

But if you still have a problem with some tests producing wrong results until you clear the cache, I'd suggest we continue to investigate this problem. If you still can reproduce it, please provide logs the cover problem reproduction and a description of the problematic scenario:

1. Delete all the files from your ReSharper log folder.
2. Run Visual Studio with the following command line key: /ReSharper.LogLevel Verbose;
3. Open (Extensions |) ReSharper | Options | Tools | Unit Testing | Test Runner;
4. Change Logging level to Trace;
5. Try running tests;
6. Revert Test Runner's Logging level to OFF;
7. Zip all the files from your ReSharper log folder and attach the archive.

Thank you in advance.

0

Could you please collect the logs using the following instruction and attach them with a new issue on our tracker? Thank you in advance! 

-1

Please sign in to leave a comment.