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.88k stars 352 forks source link

Spade + Code Cleanup crash on rename of base class while its derived class is open in an editor window #1008

Open daforrester opened 1 year ago

daforrester commented 1 year ago

Environment

Description

If both "automatic cleanup on save" and Spade are enabled, CodeMaid will consistently crash Visual Studio whenever you rename a base class while one of its derived classes is also open. (This happens despite the "Skip During Automatic Cleanup on Save" option being turned on, which was listed as the solution for several similar rename issues.)

The workarounds I've found so far are: a) Always remember to close all editor windows before rename b) Turn off automatic cleanup on save (not ideal) c) Don't use Spade (not ideal - it's a very useful tool)

I've disabled what few extensions I was using and the crash still occurs, so extension conflicts probably are not involved here.

Steps to recreate

Setup work:

  1. Enable "General > Skip During Automatic Cleanup on Save" to prove that this option does not resolve the crash.
  2. Enable Spade and put it on the side of Visual Studio somewhere.
  3. Make sure you have some sort of automatic cleanup enabled, such as "Cleaning > Visual Studio > Run remove and sort using statements".
  4. Enable "Cleaning > Visual Studio > Skip during automatic cleanup on save" to prove that this also does not resolve the crash.
  5. Make sure "General > Features > Automatically run cleanup on save" and "General > Features > Spade" are both turned on.

Reproducing the crash:

  1. Create an empty console application (C# using .NET Core)
  2. In a file A.cs, create an empty class A
  3. In a file B.cs, create an empty class B that derives from A
  4. Open both A.cs and B.cs in the editor (this is critical - it will not crash unless both files are open when the rename occurs)
  5. In A.cs, right-click on symbol "A" and rename it back and forth several times between A and Az (but make sure "Rename symbol's file" is also checked; the crash won't happen unless the filename changes too)
  6. You should get a guaranteed full lockup of Visual Studio within about 1-2 renames.

Here is my config, in case the above information isn't enough: CodeMaid config.zip

Current behavior

The rename operation freezes Visual Studio with a window that says "Updating files..." - you can't cancel it; you have to force quit

Expected behavior

The rename operation should not freeze.