Deadlock starting Visual Studio 2022 with pinned files

Hi

I’m having a deadlock issue after installing the SonarLint extension in Visual Studio 2022.

  • Operating system: Windows 10
  • Visual Studio version: 17.10.6
  • SonarLint plugin version: 8.2.1.96841
  • Programming language you’re coding in: c#
  • Is connected mode used: Did not configure anything, so probably no.

And a thorough description of the problem / question:

  1. Have a Visual Studio solution (from a Git repository) and having that solution as a pinned element in the Windows task bar, to directly open the solution in Visual Studio 2022.
  2. Before closing the solution have some code files open and pin an open code document in Visual Studio. Close Visual Studio.

If now Visual Studio is opened directly with the solution (e.g. using the pinned element in the task bar), Visual Studio will encounter a deadlock while loading the file content.
Note that opening an empty Visual Studio and opening the solution from there works fine.

The callstacks of the deadlock show SonalLint accessing the “DaemonLogLevel” setting from a background thread and from the main UI thread of Visual Studio and seem to block each other. See both attached screenshots.


I hope this helps reproduce the issue.

Best Regards,
Karsten

I, too, am facing this issue (repeatedly). So far, the only way to resolve it has been to force-delete the entire folder and re-pull it from git to get unblocked.

The issue looks like lock contention, where there’s a wait but it’s not been (and will never be) released.

VS 17.11.1
Sonarlint extensions 8.2.1.96841
C# Solution .NET 8.0
I have also the same problem. i have a solution bind to sonarcloud.

If i close Visual Studio solution with opened files, when i repoen the solution, Visual Studio is busy and the current file opened shows “Loading editor packages”

If i disable the extension, it works, the solution opens without problem with the current file.

If i modify analysis options to not run code analysis :


the solution opens without problem.

Best regards

Hi @Karsten and thank you for reporting this problem
The issue seems strange and I’ve never encountered it in vs17.9, but one of my colleagues confirmed they had it in vs17.10, which matches your version. The code that is getting deadlocked has not changed for a very long time which is why the error is so surprising to me.

I will look into this and get back to you as soon as I have something concrete.

1 Like

Hi @trexdev and thank you for reporting this problem.

You can find more details here: Deadlock starting Visual Studio 2022 with pinned files - #6 by georgii.borovinskikh

Hi @fbregeon and thank you for reporting the problem.

You can find more info here: Deadlock starting Visual Studio 2022 with pinned files - #6 by georgii.borovinskikh

Small note: I don’t think the Run background code analysis setting should make any difference, as this setting only controls the execution of the roslyn analyzers. Those are run by VS and do not access the logging infrastructure of SonarLint, which is where the deadlock seems to happen.

@Karsten @trexdev @fbregeon

I think I have found the issue with the Lazy settings initialization in our logger. Thank you so much for providing the callstacks, as I couldn’t reproduce this on my PC, and those were very helpful in identifying the problem.

To verify that we actually fixed the problem, could you please try this build and share your feedback in this thread?

https://sonarsource.box.com/s/k22fbkg4wd8751o2a03g121b4mpck137

1 Like

Thanks, but i can’t download file from the link
https://sonarsource.box.com/s/k22fbkg4wd8751o2a03g121b4mpck137

No action to download are available.

I don’t have an account.
it seems that you have to provide a credit card number to get a free account.
And i don’t want to do that :slight_smile:

Yeah that’s strange. I will ask why it is like that and get back to you.

Could you try again? Should be fixed now

Thanks a lot! It’s working fine with this version.

I’m keeping this version while waiting for the patch.

Best regards and thank you again for your responsiveness

1 Like

I can also confirm, that the provided version of the extension no longer shows the behavior described in the issue. Opening solutions with or without pinned files works fine now.
Thank you.

1 Like

Version 8.2.2.98119 has been released. Note, that the test build in this thread was of version 8.3, so you need to uninstall that, as VS doesn’t update to a lower version.

1 Like