1

Topic: InvalidOperationException for solution with file opened

Getting System.InvalidOperationException in ViEmu 3.7.6 and Visual Studio 2017 (15.9.3). Steps to reproduce:
- create new solution in Visual Studio, open any file in it and close Visual Studio without closing the editor.
- try to load this solution in Visual Studio. On solution load VS is trying to open the editor with file that was left opened and shows exception alert.

System.InvalidOperationException: "GetTextViewLineContainingBufferPosition called before view is fully initialized."

Call Stack (truncated):
   Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.Microsoft.VisualStudio.Text.Editor.IWpfTextView.GetTextViewLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition)
Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.GetTextViewLineContainingBufferPosition(Microsoft.VisualStudio.Text.SnapshotPoint bufferPosition)
Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Text.MultiSelection.Implementation.SelectionUIProperties.TryGetContainingTextViewLine(out Microsoft.VisualStudio.Text.Formatting.ITextViewLine line)
Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Text.MultiSelection.Implementation.SelectionUIProperties.ContainingTextViewLine.get()
Microsoft.VisualStudio.Platform.VSEditor.dll!Microsoft.VisualStudio.Text.Editor.Implementation.CaretElement.ContainingTextViewLine.get()
VSHub.dll!VSHub.ViEmuCaret.CalcCaretSize()
VSHub.dll!VSHub.ViEmuCaret.SetCaretType(nglib.ViCaretShape caret)
VSHub.dll!VSHub.ViEmuCaret.Initialize(VSHub.ViEmuView _qView)
VSHub.dll!VSHub.ViEmuView.InitializeWpfInterfaces()
VSHub.dll!VSHub.ViEmuViewManager.TextViewCreated(Microsoft.VisualStudio.Text.Editor.IWpfTextView qTextView)