codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

The "Reorganize Active Document" function does not work ! vs 2017 Community, vs 2019 Community preview #911

Open macgile opened 2 years ago

macgile commented 2 years ago

Environment

The description

The "Reorganize Active Document" function does not work

Current behavior

Executing "Reorganize Active Document" gives no result, nothing happens. Does not work for 2017 and 2019 community versions.

Steps to recreate

1 Open cs file 2 Click Reorganize Active File

Predictable behavior

Add regions and rearrange the document structure.

Console output

[CodeMaid Diagnostic 08:09:36 ] ReorganizeActiveCodeCommand.OnExecute invoked [CodeMaid Diagnostic 08:09:36] CodeReorganizationManager.Reorganize started for 'C:\Users_\source\repos\macgile\DataGridFilter.actual\Shared\FilterDataGrid.cs' [CodeMaid Diagnosis 08:09:36] CodeModelManager.RetrieveAllCodeItems for 'C:\Users_\source\repos\macgile\DataGridFilter.actual\Shared\FilterDataGrid.cs' [CodeMaid Diagnostic 08:09:36 ] CodeModelCache.GetCodeModel for 'C:\Users\GILLES\source\repos\macgile\DataGridFilter.actual\Shared\FilterDataGrid.cs' [CodeMaid Diagnostic 08:09:36 ] -- fetched from cache (not obsolete). [CodeMaid Diagnostic 08:09:36 ] CodeReorganizationManager.Reorganization completed for 'C:\Users__\source\repos\macgile\DataGridFilter.actual\Shared\FilterDataGrid.cs'

codecadwallader commented 2 years ago

Thanks for reporting the issue. Does it happen on all files and projects or only certain ones? If you create a new template C# application and attempt to reorganize the default Class1.cs does the same issue occur?

DuncanStone commented 2 years ago

I had this issue too. Some additional details which might help: Clean up on save was turned off. I turned clean up on save on, and then cleanup neither worked on save, nor on manual initiation. I created a new blank project to answer the developer query above. Codemaid worked correctly on this project. I returned to the main project I am working on, at this point code maid was working again. Both on save and when activated in the menu.

I know this is not sufficient for a reproduction, but hopefully it helps. At least it offers a workaround of sorts. If it happens again or if others are experiencing this, check what happens if you open another existing solution and then return to the original one.

My best guess is that some solutions (mine is quite large) have an issue initialising when they first load or something.

codecadwallader commented 2 years ago

Thanks for those details @DuncanStone . VS extensions like CodeMaid all load asynchronously in the background in order to improve the startup performance of Visual Studio. There definitely can be a delay before extensions are available and yes a larger solution will make that a longer delay as there's more work happening in the IDE. You can tell if CodeMaid is fully loaded or not by looking to see if it's menu is fully available at Extensions->CodeMaid.