-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Chsarpier freezes Rider #926
Comments
I believe I ran into issues like this early on but I thought they were fixed. Hopefully the logs will give some more information. |
Same issue here, at least once per day. Sometimes more. I'll try to collect logs. |
I confirmed yesterday that when Rider was frozen, killing CSharpier unfroze it. I didn't see anything in the logs though. I have had occasional freezes in the last few weeks that were probably the same thing, but forgot about this and wasn't looking for it. I may need to add some more debug logging to narrow down the problem. I believe when it happened yesterday I was saving a file that wasn't able to be compiled yet (missing a } or something similar) |
I have seen this issue quite a lot over the last 12 months. I think it happens more when I am working on code containing |
So I realized tonight that the VS plugin has a similar issue, where it csharpier would freeze if another plugin happened to run at the same time. I implemented basically the same code from #890 into the rider plugin, and did some testing where I forced csharpier to freeze and ensured it restarts successfully. So even not being able to reproduce the problem I believe that 1.3.9 will prevent the freezes (or at least keep them to just 3 seconds). Jetbrains does have to approve plugins, which may take a day or two before it is available. |
Looks like it's working! Updated the plugin and just got a freeze, but it unfroze again within a few seconds. EDIT: While working in some problem files, I've gotten roughly 10 freezes so far today. Each time it unfroze again without issue. |
Is it possible to share one of those files? It would seem odd that specific files would cause the problem if they promptly start working later. Ideally I'd like to figure out the cause, because if it is happening 10 times a day that can still be annoying. Another option would be for you to try running the plugin locally in debug via intellij. If you can debug the code when it occurs maybe it is possible to understand why it occurs. |
Unfortunately those files are no longer in the state they were in that caused the hangs. If I get another file that does it, I'll send you a copy. |
If it seems to be the same files, it could be that there is a certain sequence of characters that is causing the issue. The plugin streams the file contents to the actual csharpier process, which then writes it back out formatted on std out. With some special characters as delimiters. It is on the list to redo this using something like protobuf + named pipes, but it was good enough for a first pass. I was also hoping that native AOT would become viable. The csharpier process stays running because starting it up is slow compared to the actual formatting of code. I tested out an AOT version of csharpier, and it formatted fast enough to not require leaving it running. As far as I know it isn't possible yet to distribute a dotnet tool. |
@belav I have a file which I'm in the middle of refactoring and is freezing up on me frequently. There's no way I've found to reliably make it freeze, but it's happening pretty often. How shall I send you the file? EDIT: Actually, I did find a way to make it freeze every time. |
@ShawnTheBeachy I don't suppose it is in a public repo? You can also just attach it to a comment, may have to zip it first. |
It's not public, no. I've uploaded a copy with the only change being to substitute "CorpName" for the company name in the file. |
@ShawnTheBeachy I was able to recreate this just by changing some text on line 71, I was worried I would have to go down the route of getting the file compile-able to use the "Convert to '?:' operator". I can produce it reliably so I'm hoping I can track down a proper fix. Thanks for sharing it! |
The problem ended up being that the csharpier process was writing compilation errors to stderror. Nothing in the rider plugin was reading the error stream, so eventually it would hang. I was able to reproduce it with that file because without having the rest of the classes in the using statements, there were 26 compilations errors. Every other time I formatted it the error stream filled up and hung. The seemingly randomness of seeing it makes a lot more sense now. I uploaded version 1.3.10 of the plugin, which will be available in a couple of days. |
I am using 1.3.10 of the plugin on MacOS 13.4 and Rider 2023.2. I am still running into the problem, where CSharpier causes Rider to freeze. Furthermore, when I try to format a file it fails and Rider provides me with the following stacktrace in the IDE internal errors window:
|
@lemaku I ended up trying to code a fix before getting more info and probably should have started with getting more info, but either way I have some auto retry logic built in https://github.com/belav/csharpier/releases/tag/rider-1.3.11-beta1, which may help. Some questions
|
@belav Sorry for the late response. I ended up sticking to a different tool, but wanted to follow up on your questions:
|
@belav I've just upgraded I also noticed that after installing the new version and restarting Rider, Rider requested access to a Network volume on my Mac (I don't recall exactly what was the message) I'm using Mac: 14.0 Rider logs:
|
@viniciuschiele I didn't recreate this exactly, but that could be because I am running on windows. With windows it is not reformatting files, and the dotnet-csharpier process appears to be failing to start with the following. I found this in the event viewer in windows, not sure what the mac equivalent would be.
|
actually, that appeared to be a failed install of the 0.26.0 version. wiping out my You can see if doing the same for Otherwise I was thinking the problem could be related to the new editorconfig support. Do you have any editorconfig files in your solution? What about any .csharpierrc files? |
Hi, I'm experiencing the issue exactly as @viniciuschiele describes - also Mac, also the Network volume prompt. I can confirm that deleting my local .editorconfig stopped Rider from freezing. This is my first attempt at getting CSharpier working in our project, so I can't say anything about previous versions. But it froze 100% of the time I saved a file in Rider until I deleted the editor config. |
@riandrake if your editorconfig had duplicated sections, then I do have a fix coming out shortly. See #989 (comment) |
I'm not using
I deleted the folder @belav Rider freezes when I type anything in a |
@viniciuschiele if you try a new project with the same .csharpierrc.yaml do you get the same issue? The reason it freezes on typing is because behind the scenes the plugin tries to ensure csharpier is ready to format a file when you do hit save. When I added the logic to detect a hung csharpier I neglected to add a bail condition, so it gets stuck in a loop right now. I created #995 yesterday to try to improve the situation when the csharpier process is crashing. And I have a few other issues on the 0.26.0 milestone around improvements to the extensions that I'm hoping to get to next. I'll be out of town for a long weekend starting tonight so you may be stuck on 0.25.0 for a bit. |
@belav I tried a new project with/without The process |
FWIW, people using macOS on our team encountered this same issue on v0.26.1, using |
Just updated from 0.25.0 to 0.26.2, my logs are full of
|
I believe there are two possible causes for the issues with freezing, both of which appeared on an older install of windows I switched to because I was having trouble compiling the rider extension on my fresh install.
As a resolution
I'm modifiying all of the extensions to detect these conditions and supply an error message that will allow users to resolve the problem. |
If I don't forget, I'll try that, but for additional info: I'm on linux and I did not update to .Net 8 yet, still on .net 7 |
I also don't have dotnet8 installed. I did all the steps above.
Anyway, I wiped out the folder The issue still persists. |
I didn't have time to fully test this but the new 1.5.0-beta2 version will do a better job of logging and reporting failures starting CSharpier. Also if you do get the popup with a read more link, I didn't get a chance to finish up that troubleshooting page. @viniciuschiele I'm curious if this will show the reason why the plugin is unable to run CSharpier for you. |
@belav I wasn't aware of the plugin beta versions. I tried I rolled back to version |
These are the logs from version
|
I released |
Yes, it is working now. Thanks |
When I refactor Code, Csharpier freezes the UI sometimes.
Unfortunately it's impossible to reproduce reliably.
It mostly happens when I reformat code and the code is broken for a moment.
Can I find logs somewhere?
Usually killing the Csharpier Task via Taskmanager and then reenabling the Plugin unfreezes the Ui.
The text was updated successfully, but these errors were encountered: