-
Notifications
You must be signed in to change notification settings - Fork 783
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
IDE code analysis starts to freeze on large files affecting Intellisense, text coloring, tooltips and responsiveness #16050
Comments
This needs an FCS or VS repro, since we're unable to debug rider, and I can't see it in latest VS. |
@auduchinok how old is FCS fork in the affected version? |
What is |
Target multiple platforms from Avalonia single project . Similar to what Maui does it. More info https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/single-project Update: Basically NET 7 single project with MsBuild custom targets for Mobile,Desktop |
Yeah, I can repro. Eats up all memory and freezes VS. Looks like the problem occurs earlier than |
What's the VS version? |
Version is current preview, I can see it also in Rider EAP. |
@0101 you weren't able to repro it on main, right? |
@vzarytovskii I did a snapshot and it seems that the compiler allocates quite a lot of these: |
Ok, one difference I see with main is that it now uses CEs a lot more. It's a kind of known issue with them. |
It's an interesting point, but both performance snapshots and memory snapshot screenshot above point to pattern match compilation, not computation expressions. Regardless, I think we should think how to make IDEs perform better in the face of such code. |
It is used in many places, in the codegen for comparers, for example as well. Wondering what are the roots for the allocations in the dump above, @majocha do you have the dump still? |
@vzarytovskii, sorry I don't have it. But I extracted the problematic code for easier repro: |
@majocha Could you try to extract that into a console app project, so dependencies and script-specific things couldn't influence the issues, please? |
@auduchinok |
Even without the packages? |
@vzarytovskii all I do is open the solution from https://github.com/majocha/IdeFreeze, open |
Looks like a weird loop of rewriting/investigating pattern matching. Where TDSwitch is getting recreated for the whole decision tree. |
This actually could be the reason for the analysis explosion if, for example, it builds a bigger decision tree on each unresolved name error like that. Edit:
Yes, exactly, it's something like what I've had on my mind, I haven't seen your reply. |
Probably related or the same issue as #15086 |
Thanks @majocha for finding a minimal repro for this issue. I hope in the future we can make IDEs perform better in this cases like this, When using |
Hey @majocha can you check if this still reproduces in the latest VS? I tried your repro, both the script and the project, nothing terrible is happening on my machine. I couldn't get to the original Fabulous repro, the branch doesn't exist anymore I think. |
@edgarfgp, can you update the link in the original issue text? This gives a 404 (or instead, just paste whatever images are supposed to be there?): https://github.com/fabulous-dev/Fabulous.Avalonia/tree/repro-code-analysis-freeze/idesnapshots (edit: I think @psfinaki had the same issue with that repo, lol, maybe point to a specific commit in main?). I just tried to understand what used to happen here as currently, I sometimes see only partial refresh of source code highlighting, leading to parts staying grey/white-ish. |
Seeing this quite frequently in VS, I'm wondering if it wouldn't be helpful to have some kind of watchdog in VS / interaction with FCS: if a document is not semantically colorized / type checked after arbitrary time limit and nothing is in the queue for this document, maybe it should be attempted again? |
Fortunately I had a copy in my local machine. It should work now @abelbraaksma @psfinaki. Tried and in Rider and this branch still freezes and eats all my memory. |
@psfinaki Rider is behind in the version of FCS it uses, it needs to be tested on the main with vsix deployed. There were a couple of changes in the CEs recently, but I wouldn't expect it to be fixed. |
There was attempt to improve this #16430 but got abandoned |
@smoothdeveloper yeah, same here, but it's not likely the same issue that plagues the freezing of IDE as mentioned here. Perhaps we should create a separate issue on the repaint/refresh problem? I did notice something odd while testing, though. I changed all colors to one single color and tested that in VS. This worked initially, but after some time, it magically refreshed and showed the expected color encodings, though partially (it shouldn't have shown any coloring, as I hard-coded them. This seems to point to some caching and/or separate location in the code where coloring is done). |
@psfinaki I tested on main and it still eats memory indefinitely. |
Yes, that what I would expect. Decision trees compilation is very heavy, and more issues you have in code, the worse it will be. Ideal solution would be to move TClause to typed tree and do most (if not all) checks in the post inference phase. Additionally there can be a switch for tooling to skip tdswitch compilation as a whole. And only do it when compiling. Unsure about this one though. |
While working in
Fabulous.Avalonia
, had my project in a refactoring "broken" state, and suddenly it went in a borked state . Had to manually remove parts of the code until the IDE was able to handle it again.Repro steps
Provide the steps required to reproduce the problem:
Fabulous.Avalonia.sln
If possible, attach a zip file with the repro case. This often makes it easier for others to reproduce.
The zip file should ideally represent the situation just before the call/step that is problematic.
You can find the related IDE snapshot if that help diagnosing the issue https://github.com/fabulous-dev/Fabulous.Avalonia/tree/repro-code-analysis-freeze/idesnapshots
Expected behavior
Regardless of the state of your project. the IDE should be able to analyze/report the state of your code.
Actual behavior
IDE code analysis starts to freeze on large files affecting Intellisense, text coloring, tooltips and responsiveness
Known workarounds
Start removing part of the code in
State.fs
until the IDE/Compiler is able to handle the solutionProvide a description of any known workarounds.
Related information
Provide any related information (optional):
The text was updated successfully, but these errors were encountered: