question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SA1649 code fix crashes when renaming file

See original GitHub issue

Visual Studio 15.3.1, attempting to rename a file “Services\HistoricalData\Implementation\RateHistoryClassMap.cs” to “Services\HistoricalData\Implementation\FullRateHistoryEntryClassMap.cs”.

The stack trace is as follows:

System.AggregateException : One or more errors occurred. ---> Could not find file 'Services\HistoricalData\Implementation\RateHistoryClassMap.cs'.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.InvokeWorker(Func`1 getFromDocument,IProgressTracker progressTracker,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<>c__DisplayClass18_0.<InvokeCore>b__0()
   at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformAction(IExtensionManager extensionManager,Object extension,Action action)
---> (Inner Exception #0) System.IO.FileNotFoundException : Could not find file 'Services\HistoricalData\Implementation\RateHistoryClassMap.cs'.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.InvisibleEditor..ctor(IServiceProvider serviceProvider,String filePath,IVisualStudioHostProject projectOpt,Boolean needsSave,Boolean needsUndoDisabled)
   at Microsoft.VisualStudio.LanguageServices.RoslynVisualStudioWorkspace.OpenInvisibleEditor(IVisualStudioHostDocument hostDocument)
   at Microsoft.VisualStudio.LanguageServices.RoslynVisualStudioWorkspace.OpenInvisibleEditor(DocumentId documentId)
   at Microsoft.VisualStudio.LanguageServices.Implementation.GlobalUndoServiceFactory.WorkspaceUndoTransaction.AddDocument(DocumentId id)
   at async Microsoft.CodeAnalysis.Editor.Implementation.CodeActions.CodeActionEditHandlerService.ApplyAsync(<Unknown Parameters>)<---

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bjornhellandercommented, Apr 24, 2022

For the record: There is now a Renamer.RenameDocument method available from version 3.7 of Microsoft.CodeAnalysis.Workspaces.Common, which seems to require Visual Studio 16.7.

0reactions
sharwellcommented, Apr 25, 2022

We should be able to invoke that via a light-up layer for cases where it is supported.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio 2022 crashing when I try to rename/delete a file
The solution I found online was to delete the .vs folder. Reopening VS recreates the folder and json editing was fine again. Poster...
Read more >
file explorer crashing when i rename something and when i ...
Whenever i rename a file my file explorer crashes and when i end the task my screen turns COMPLETLEY black. Heres an ms...
Read more >
File name must match first type name` refactoring doesn't work
StyleCop `SA1649: File name must match first type name` refactoring doesn't work ... RIDER-70286 Roslyn code fix is not working for RS2008.
Read more >
Windows 11 File Explorer freezes when renaming files
Hi, my file explorer lags (or freezes for few seconds) every time i rename files and happened in any folder or files in...
Read more >
Rename file to refactor causes VS Freeze
4. Now, WITH OUT saving the file, click on the class name and select the refactor dropdown -> Rename file to “Test1.cs”. 5....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found