Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS: crash or hang when accessing F# Text Editor options #16965

Closed
majocha opened this issue Mar 28, 2024 · 11 comments · Fixed by #17015
Closed

VS: crash or hang when accessing F# Text Editor options #16965

majocha opened this issue Mar 28, 2024 · 11 comments · Fixed by #17015
Labels
Area-VS VS support for F# not covered elsewhere Bug Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Regression
Milestone

Comments

@majocha
Copy link
Contributor

majocha commented Mar 28, 2024

Current main installed on 17.10 preview 2:

Repro steps

Open settings, go to Text Editor -> F# -> Advanced ( or any other F# page).

VS either hangs or crashes and restarts.

Attempting to debug this in experimental instance I get:

Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. The address of the error was at 0x423bffe8, on thread 0x763c. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.'

@github-actions github-actions bot added this to the Backlog milestone Mar 28, 2024
@brianrourkeboll
Copy link
Contributor

I've seen this as well.

@majocha
Copy link
Contributor Author

majocha commented Mar 28, 2024

Possibly it's some VS platform / WPF bug.
It happens around setting DataContext for the view, the options window just breaks:
image

@majocha
Copy link
Contributor Author

majocha commented Mar 28, 2024

Original version released with 17.10 preview i.e:
Visual F# Tools 17.10.0-beta.24127.3+b57dee7cec971021547a7b8a36a46d7271fea99e
works fine.

@abonie abonie added Regression Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Area-VS VS support for F# not covered elsewhere and removed Needs-Triage labels Apr 8, 2024
@vzarytovskii
Copy link
Member

I bet it's translation.

@vzarytovskii
Copy link
Member

Ok, maybe not

Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "Microsoft.VisualStudio.FSharp.Editor.SettingsStore+ISettingsStore" but found 0 after applying applicable constraints.
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()
   at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Microsoft.VisualStudio.FSharp.Editor.OptionsUIHelpers.AbstractOptionPage`1.OnActivate(CancelEventArgs _arg1) in C:\Users\vlza\code\fsharp\vsintegration\src\FSharp.Editor\Options\UIHelpers.fs:line 37
   at Microsoft.VisualStudio.Shell.DialogPage.DialogSubclass.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at Microsoft.Internal.VisualStudio.Shell.Interop.IVsToolsOptionsPrivate2.ShowToolsOptions(Guid selectedPageId)
   at Microsoft.VisualStudio.Services.UnifiedSettings.VsCommands.ToolsOptionsCommand.<>c__DisplayClass6_0.<<Execute>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Shell.VsTaskLibraryHelper.<>c.<<FileAndForget>b__35_0>d.MoveNext()

@vzarytovskii vzarytovskii linked a pull request Apr 10, 2024 that will close this issue
@majocha
Copy link
Contributor Author

majocha commented Apr 10, 2024

@vzarytovskii this call stack looks helpful! I got it to work again at least in debug. I'll post what I got soon.

@majocha
Copy link
Contributor Author

majocha commented Apr 10, 2024

Nah, now I just can't repro this at all, on main without any changes. It just comes and goes. At least not in the experimental VS instance.

@vzarytovskii
Copy link
Member

Nah, now I just can't repro this at all, on main without any changes. It just comes and goes.

My "fix" in PR seems to work for me 5/5 times (when VSIX is deployed). It looks like something is wrong with MEF, I have 2 working theories:

  1. There's a race condition between when we registering it in the EditorOptions type (via properly attribute).
  2. Something changed with registering it + visibility.

It seems I can't figure out for sure what's happening.

@majocha
Copy link
Contributor Author

majocha commented Apr 10, 2024

@vzarytovskii I can't repro in debug at all now, but I'll test your fix on my VS installation in a moment.

@vzarytovskii
Copy link
Member

@vzarytovskii I can't repro in debug at all now, but I'll test your fix on my VS installation in a moment.

I couldn't reproduce in debug either

@majocha
Copy link
Contributor Author

majocha commented Apr 10, 2024

Works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VS VS support for F# not covered elsewhere Bug Impact-High (Internal MS Team use only) Describes an issue with extreme impact on existing code. Regression
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants