Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Projection buffer crashes the visual studio

$
0
0

Hi,

I have created a projection buffer using the invisible editor. I used similar technique as described on this link https://joshvarty.wordpress.com/2014/08/01/ripping-the-visual-studio-editor-apart-with-projection-buffers/

It works as expected, but I have encountered on strange bug and I can't figure out how to fix it, because it comes from VS internals. Here are the repro steps:

- Create projection buffer that will have some inner scope of the whole buffer (let's say whole buffer length is 100, we create projection buffer between 20 and 50 positions)

- move caret inside the code editor (which is showing projected view) at the last position

- press space

- press Enter

- Exception is thrown with following message and stack:

Message:

 Inconsistent length calculation in projection snapshot.

Stack trace:

   at Microsoft.VisualStudio.Text.Projection.Implementation.ProjectionSnapshot..ctor(ProjectionBuffer projectionBuffer, ITextVersion version, IList`1 sourceSpans)
   at Microsoft.VisualStudio.Text.Projection.Implementation.ProjectionBuffer.MakeSnapshot(List`1 newSourceSpans)
   at Microsoft.VisualStudio.Text.Projection.Implementation.ProjectionBuffer.TakeSnapshot()
   at Microsoft.VisualStudio.Text.Projection.Implementation.ProjectionBuffer.InterpretSourceChanges(EditOptions options, Object editTag)
   at Microsoft.VisualStudio.Text.Projection.Implementation.ProjectionBuffer.PropagateSourceChanges(EditOptions options, Object editTag)
   at Microsoft.VisualStudio.Text.Implementation.BufferGroup.PerformMasterEdit(ITextBuffer buffer, ISubordinateTextEdit xedit, EditOptions options, Object editTag)
   at Microsoft.VisualStudio.Text.Implementation.TextBuffer.BasicEdit.PerformApply()
   at Microsoft.VisualStudio.Text.Implementation.BaseBuffer.TextBufferEdit.Apply()
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.DocumentProvider.StandardTextDocument.UpdateText(SourceText newText, ITextBuffer buffer, EditOptions options)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.DocumentProvider.StandardTextDocument.UpdateText(SourceText newText)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.MiscellaneousFilesWorkspace.ApplyDocumentTextChanged(DocumentId documentId, SourceText newText)
   at Microsoft.CodeAnalysis.Workspace.ApplyProjectChanges(ProjectChanges projectChanges)
   at Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Solution newSolution)
   at Microsoft.CodeAnalysis.Editor.Shared.Extensions.IWorkspaceExtensions.ApplyTextChanges(Workspace workspace, DocumentId id, IEnumerable`1 textChanges, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Formatting.Indentation.AbstractSmartTokenFormatterCommandHandler.FormatToken(ITextView view, Document document, SyntaxToken token, IEnumerable`1 formattingRules, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Formatting.Indentation.AbstractSmartTokenFormatterCommandHandler.TryFormatUsingTokenFormatter(ITextView view, ITextBuffer subjectBuffer, Document document, IEnumerable`1 formattingRules, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Formatting.Indentation.AbstractSmartTokenFormatterCommandHandler.ExecuteCommandWorker(ReturnKeyCommandArgs args, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Formatting.Indentation.AbstractSmartTokenFormatterCommandHandler.ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler)
   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.<>c__DisplayClass6_1`1.<ExecuteHandlers>b__1()
   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameCommandHandler.ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler)
   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.ExecuteHandlers[T](IList`1 commandHandlers, T args, Action lastHandler)
   at Microsoft.CodeAnalysis.Editor.Implementation.Commands.CommandHandlerService.Microsoft.CodeAnalysis.Editor.ICommandHandlerService.Execute[T](IContentType contentType, T args, Action lastHandler)
   at Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.ExecuteReturn(ITextBuffer subjectBuffer, IContentType contentType, Action executeNextCommandTarget)
   at Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.ExecuteVisualStudio2000(Guid& pguidCmdGroup, UInt32 commandId, UInt32 executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType)
   at Microsoft.VisualStudio.LanguageServices.Implementation.AbstractOleCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 commandId, UInt32 executeInformation, IntPtr pvaIn, IntPtr pvaOut)
   at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
   at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
   at Jinnee.Shared.CommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in d:\Development\repos\Jinnee.Prelude\Jinnee.Prelude.Shared\CommandFilter.cs:line 65


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>