Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio 17.8.0 hangs with version 1.4.8 #1026

Open
danielcandea opened this issue Nov 17, 2023 · 19 comments
Open

Visual Studio 17.8.0 hangs with version 1.4.8 #1026

danielcandea opened this issue Nov 17, 2023 · 19 comments

Comments

@danielcandea
Copy link

I did a fresh install of Windows 11 build 22621.2715, installed CSharpier plugin 1.4.8 and Visual Studio hangs after a few seconds after opening a solution.

I can reproduce this every time with CSharpier being the only plugin installed. Once I uninstall it and add my usual ones everything works fine.

@belav
Copy link
Owner

belav commented Nov 17, 2023

If you are using CSharpier 0.26.* (which would happen if you are clicking install globally/locally) then this is probably the same issue that is occurring across all of the IDEs. I'm hoping to be able to track it down soon.

As a workaround you can install csharpier 0.25.0 outside of the plugin.

@belav belav modified the milestones: 0.26.2, 0.26.3 Nov 17, 2023
@belav
Copy link
Owner

belav commented Nov 17, 2023

I have a few questions, I think most other people are experiencing complete freezes that VS doesn't recover from.

Does VS go back to normal after a few seconds or is it a complete freeze?
Does switching to 0.25.0 make the problem go away.
Are you able to format any files?
Could you share what is in the output window for CSharpier? Turning on log debug messages first will give more info.

@danielcandea
Copy link
Author

VS doesn't recover, it remains like that. But it isn't like "Not Responding" freeze, being greyed out, more like there is an invisible dialog window preventing clicks and scrolling. Clicking VS icon in the taskbar doesn't do anything either.

I can't do anything past VS opening the solution, not seeing output, not opening a file or format an existing one. The only way to uninstall the plugin was to open VS without code.

I downgraded to 0.25.0 and the plugin seems fine again.

@belav
Copy link
Owner

belav commented Nov 19, 2023

I believe I know a way to resolve the problem, see #926 (comment) for more details

@danielcandea
Copy link
Author

That didn't solve the issue, but while going through issue I saw that duplicate lines in .editorconfig might cause problems so I checked it and had some duplicates. I removed them and things seem fine now, csharpier installed globally, v0.26.2 and the VS plugin v1.4.8.

@IT-CASADO
Copy link

I'm facing the same issue with v0.26.2 and the VS plugin v1.4.8.
My .editorconfig doesn't have any duplicates and the mentioned workarond by @belav doesn't help.

This ticket should be re-opened.

@IT-CASADO
Copy link

Seems to be fixed with version v0.26.3 :)

@IT-CASADO
Copy link

IT-CASADO commented Dec 15, 2023

This is not fixed. VS hangs regularly on my machine and for colleagues.

If that happens I can see CPU spikes forced by CSharpier:

image

If I wait for a long time (or kill the CSharpier task in Task Manager) I'm ending with #1072.
This is very frustrating.

I tried the troubleshooting guide multiple times, but it doesn't help.

This is from log:

Starting
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.
CSharpier process appears to be hung, restarting it.

And VS is showing me:

image

@danielcandea danielcandea reopened this Dec 15, 2023
@danielcandea
Copy link
Author

Started happening again, slightly differently for me as well, every time I open Visual Studio I get a message that it stopped responding for about 15-20 seconds, afterwards it seems fine.
I am using Visual Studio 17.8.3, plugin 1.4.8 and the tool is at 0.26.6.

@IT-CASADO
Copy link

For me sometimes it's still working after the 'stopped responding' message.

I very often open Visual Studio and VS Studio Code at the same time. I think in this case CSharpier is broken in Visual Studio after the message. But this is only a feeling...

In Visual Studio Code I don't get any issues so far.

@belav belav modified the milestones: 0.26.3, 0.26.7 Dec 16, 2023
@Kurren123
Copy link

Happening to me too. No .editorconfig file, I enable debug log messages and get this:

Starting
Ensure there is a csharpier process for C:\dev\PBI-SQLService
Looking for C:\dev\PBI-SQLService\.config/dotnet-tools.json
Looking for C:\dev\.config/dotnet-tools.json
Looking for C:\.config/dotnet-tools.json
Unable to find dotnet-tools.json, falling back to running dotnet csharpier --version
dotnet csharpier --version output: 0.26.7+c8aec144f227bda8cf195011e9d91bb36c33337f
Removing everything after + to use 0.26.7
dotnet csharpier --version output: 0.26.7+c8aec144f227bda8cf195011e9d91bb36c33337f
Adding new version 0.26.7 process for C:\dev\PBI-SQLService
Warm CSharpier with initial format
CSharpier process appears to be hung, restarting it.
Warm CSharpier with initial format

@belav
Copy link
Owner

belav commented Dec 17, 2023

I resolved a number of issues with the new 1.5.0 version of the extension. It also has better logging and notification when it is unable to start the CSharpier process.

Let me know if there are still issues!

@danielcandea
Copy link
Author

I've updated the plugin to 1.5.0 with the tool at 0.26.6 and had no issues after opening a few solutions.
Next, I've updated the tool to 0.26.7 and got one hang after opening a solution, but couldn't reproduce it afterwards after several tries.

@Kurren123
Copy link

Kurren123 commented Dec 17, 2023

I resolved a number of issues with the new 1.5.0 version of the extension. It also has better logging and notification when it is unable to start the CSharpier process.

Let me know if there are still issues!

Thanks so much, it no longer hangs (extension version 1.5.0, tool version 0.26.7). However I am getting this on every load of visual studio:

[Info - 17/12/2023 23:17:15] Starting
[Error - 17/12/2023 23:17:16] System.NullReferenceException: Object reference not set to an instance of an object.
   at CSharpier.VisualStudio.ReformatWithCSharpierOnSave.FindDocument(UInt32 docCookie)

@IT-CASADO
Copy link

In general this seems to work now :)

Visual Studio is not hanging for a long time, but I still get this message: "Visual Studio stopped responding for x seconds"

image

But everything is working so far.

In the log I can see a warning ("CSharpier process appears to be hung, restarting it.")
and sometimes an error ("Object reference not set to an instance of an object."):

My Log:

[Info - 19.12.2023 08:59:57] Starting
[Debug - 19.12.2023 08:59:58] Ensure there is a csharpier process for xxx/Report\Service\Evo.ReportEngine.Service.Job
[Debug - 19.12.2023 08:59:58] Looking for xxx/Report\Service\Evo.ReportEngine.Service.Job\.config/dotnet-tools.json
[Debug - 19.12.2023 08:59:58] Looking for xxx/Report\Service\.config/dotnet-tools.json
[Debug - 19.12.2023 08:59:58] Looking for xxx/Report\.config/dotnet-tools.json
[Debug - 19.12.2023 08:59:58] Looking for xxx/.config/dotnet-tools.json
[Debug - 19.12.2023 08:59:58] Looking for xxx\.config/dotnet-tools.json
[Debug - 19.12.2023 08:59:58] Found version 0.26.7 in xxx\.config/dotnet-tools.json
[Debug - 19.12.2023 08:59:59] dotnet csharpier --version output: 0.26.7+c8aec144f227bda8cf195011e9d91bb36c33337f
[Debug - 19.12.2023 08:59:59] Using 0.26.7 as the version number.
[Debug - 19.12.2023 08:59:59] CSharpier at C:\Users\CasadoDaniel\AppData\Local\CSharpier\0.26.7 already exists
[Debug - 19.12.2023 08:59:59] Adding new version 0.26.7 process for xxx/Report\Service\Evo.ReportEngine.Service.Job
[Debug - 19.12.2023 08:59:59] Warm CSharpier with initial format
[Warn - 19.12.2023 09:00:02] CSharpier process appears to be hung, restarting it.
[Warn - 19.12.2023 09:00:05] CSharpier process appears to be hung, restarting it.
cture
[Error - 19.12.2023 09:00:51] System.NullReferenceException: Object reference not set to an instance of an object.
   at CSharpier.VisualStudio.ReformatWithCSharpierOnSave.FindDocument(UInt32 docCookie)

@belav
Copy link
Owner

belav commented Dec 22, 2023

I believe I have the occasional NRE fixed and am releasing 1.5.1 for that.

The initial hang some people are seeing is probably csharpier being installed in the background. I think this could be avoided by converting a lot of this code to async, but it should be only occuring once when using a new version of csharpier so I'm not sure it is worth the effort.

I've managed to reproduce getting CSharpier to hang and restart itself.

  • add a bunch of compilation errors to a file
  • make change and save
  • repeat until it hangs

Rider had a similar problem, but the fix in Rider (java based) doesn't seem to apply to VS. I'll dig into that a bit more.

@IT-CASADO are you seeing the "Visual Studio stopped responding for X seconds" message regularly? It also seems like the initial warming of csharpier is hanging for you, which I have not seem before. The warming process is a simple c# class, so I can't see why it would be causing things to hang.

I do have a reworking of the communication between the extensions and csharpier using GRPC almost ready, and I am hoping that will resolve some of the flakeiness with piping input/output to csharpier.

@belav belav modified the milestones: 0.26.7, Planned - Extensions Jan 2, 2024
@parched
Copy link
Contributor

parched commented Jan 10, 2024

I've been getting this a bit recently. I'm not sure exactly when it triggers, but I think it's when there is compilation errors.
image

@mejobloggs
Copy link

I've been getting this a bit recently. I'm not sure exactly when it triggers, but I think it's when there is compilation errors. image

Same here, I get this most times I open Visual Studio

@ceisele-r
Copy link

For me, it's happening every time I open Visual Studio and afterwards open a C# file in the solution.

So to reproduce:

  1. open a Visual Studio C# solution -> all good for now.
  2. Then open a C# file, Visual Studio hangs for 10-20 Seconds and the yellow bar appears.

In contrast to @parched 's assumption, there are no compile errors in my solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants