dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.89k stars 783 forks source link

Roslyn crashes F# rename when F# project contains `cshtml` file #16394

Open vsfeedback opened 10 months ago

vsfeedback commented 10 months ago

This issue has been moved from a ticket on Developer Community.


  1. Open reproduction project
  2. Open CreateAccountPage.fs
  3. Try to rename Token property using F2 (or Ctrl+R,R)

See the attached video for details

System.Exception : The file 'C:\Users\Andrii\Dev\Projects\Marketplace\Server\Pages\Error.cshtml.reAnT4S4KLCYARJg.ide.g.cs' was not part of the project. Did you call InvalidateConfiguration when the list of files in the project changed?
   at FSharp.Compiler.CodeAnalysis.IncrementalBuilder.GetSlotOfFileName(String fileName)
   at FSharp.Compiler.CodeAnalysis.IncrementalBuilder.GetParseResultsForFile(String fileName)
   at <StartupCode$FSharp-Compiler-Service>.$Service[Redacted]@[Redacted]Tuple`2 _arg13)
   at [Redacted]@[Redacted]T x)
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt,b result1,FSharpFunc`2 userCode)
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.WorkspaceExtensions.Project-FindFSharpReferencesAsync@325-11[a](<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.WorkspaceExtensions.Project-FindFSharpReferencesAsync@326-33(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.WorkspaceExtensions.Project-FindFSharpReferencesAsync@286[a](<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers.getSymbolUsesInProjects@86-3(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers.getSymbolUsesInProjects@79-1(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers.findSymbolUses@97(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers.getSymbolUses@147(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.VisualStudio.FSharp.Editor.SymbolHelpers.getSymbolUsesInSolution@159(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at <StartupCode$FSharp-Editor>.$InlineRenameService[Redacted]@[Redacted]ResumableStateMachine`1& sm)
   at <StartupCode$FSharp-Editor>.$InlineRenameService[Redacted]@[Redacted]ResumableStateMachine`1& sm)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.FSharpInlineRenameInfo.Microsoft-CodeAnalysis-Editor-IInlineRenameInfo-FindRenameLocationsAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.<>c__DisplayClass44_0.<UpdateReferenceLocationsTask>b__0(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.<>c__DisplayClass76_0.<UpdateConflictResolutionTask>b__0(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.CommitCoreAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.CommitWorkerAsync(<Unknown Parameters>)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.CommitWorker(Boolean previewChanges)
   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameCommandHandler.Commit(InlineRenameSession activeSession,ITextView textView)

Original Comments

Feedback Bot on 11/24/2023, 02:51 AM:

(private comment, text removed)


Original Solutions

(no solutions)

vzarytovskii commented 10 months ago

Original one: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1921398

This is an unsupported scenario (fs file under cshtml file), we should just ignore those, if they're not a part of the project (or anything other than fs, fsi, fax really).