Open KirillOsenkov opened 9 months ago
Interesting, that means
was never called...
@Cosifne do you know of any changes here? We could fix the NRE, but I fear other things would be broken if we never initialize
Ah, I know what is happening.
There are two workspaces in VS: VisualStudioWorkspaceImpl and MiscellaneousFilesWorkspace. Each of them gets a new copy of InlineRenameUndoManager: https://github.com/dotnet/roslyn/blob/fc368834c6087507a5df36c49a3b7f072aec39ae/src/VisualStudio/Core/Def/InlineRename/InlineRenameUndoManager.cs#L56
By invoking inline rename in two different workspaces you're creating two copies of the InlineRenameUndoManager, that compete with each other. currentState will only be set in one of them.
I think we should reuse the same InlineRenameUndoManager for all workspaces, so keep a singleton in a field instead of returning a new instance from CreateService for each workspace.
@ryzngard Please fix, should be easy ;) Much obliged!
This seems to have fixed it:
I got myself into a state where
currentState
is null here: https://github.com/dotnet/roslyn/blob/2296cb59d33c0beeb1501dcb1c9b49bd26d025c4/src/EditorFeatures/Core/InlineRename/AbstractInlineRenameUndoManager.cs#L79Every keystroke in rename throws a NullReferenceException. Persists after I close the rename dialog and open a new session using F2.
@ryzngard