dotnet / ResXResourceManager

Manage localization of all ResX-Based resources in one central place.
MIT License
1.29k stars 211 forks source link

Loading/Unloading all strings from all resx-files in a large (??) solution causes the stuck of Visual Studio for a long time #638

Open schicout opened 3 months ago

schicout commented 3 months ago

Bug description

The initial state A solution consisting of 19 projects (500+ classes of UserControl with localization, 20000+ localizable strings) was opened and built.

Action

Loading all of 20k strings takes over a minute. And if you uncheck all checkboxes in resource tree panel, clearing the grid with a list of localizable strings will also take more than minutes. When loading/unloading localizable strings from the data grid, the grid sometimes flickers, which may points to continuous repaint the grid after checking/unchecking a checkbox in resource tree panel on the left, or, even worse, after adding/removing each string from the grid.

Workstation

Intel Pentium Core i7-11700K on Z590 chipset / RAM 64G / SSD Samsung 980-Pro / NVIDIA GeForce RTX 3050 / Video - 4K.

Proposed solution

SuspendLayout/ResumeLayout may resolve the problem (?)

https://github.com/dotnet/ResXResourceManager/assets/13622857/de9836f1-587d-416c-9d7f-e57190b74666

tom-englert commented 3 months ago

Unfortunately there is nothing like SuspendLayout/ResumeLayout in WPF.

Can you profile it with your data set to see where the bottleneck is?

schicout commented 2 months ago

I apologize for not answering for a long time - I was stuck at work, I didn’t have time to finish the tests. But today, after updating the Visual Studio to version 17.9.6 and after updating .NET (KB5037336), everything started working much faster - the same 20k strings were opened in 5 seconds. I'll check on another workstation on Sunday, but I guess everything has worked itself out.

P.S. In general, I guess that the problem was not so much in the large number of resources in the solution, but in the number of resource files in the solution. I made two empty projects - in one I wrote down 300k localized strings in one file, in the second project I made 30 files with 10k strings each. In the first project, the ResX-manager read all strings in 11 seconds, and in the second, I waited 5 minutes, then I had to kill VS using task manager. UPD. Yes, extension works correctly.