Skip to content

Several CodeFixProviders crash #2849

Open
@ruant

Description

@ruant

A lot of the CodeFixProviders keeps crashing when renaming a file has to be done.
It does the fix it seams, but it renames the file with with 1 at the end and obviously freaks out completely.

Is there a fix for this? Kinda annoying to have to rename the files to remove the 1 afterwards every time.

This is from the SA1412CodeFixProvider:

System.AggregateException : One or more errors occurred. ---> Could not find file 'C:\Projects\MyProject\RequestModel.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 'C:\Projects\MyProject\RequestModel.cs'.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.InvisibleEditor..ctor(IServiceProvider serviceProvider,String filePath,AbstractProject 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>)<---

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions