我正在使用Visual Studio 2015更新2。
我正在编写使用html编辑器的扩展。
有时我会遇到错误,说"尝试TextBuffer编辑,而另一个编辑操作正在进行",这会阻止我写入窗口我如何知道哪个操作锁定了缓冲区?
它或多或少是随机发生的。(至少我找不到任何可靠的方法来复制它。)只是chengeTextBuffer的命令受到影响,所以我可以自由调试。
如果需要,我很乐意提供任何传统信息。
我设法记录了它拖走的异常。由于命令目标链的原因,它相当长,但似乎有什么东西阻止了写入投影缓冲区。(撤销管理器?)
System.InvalidOperationException: Attempted TextBuffer edit operation while another edit is in progress.
at Microsoft.VisualStudio.Text.Implementation.BaseBuffer.TextBufferBaseEdit..ctor(BaseBuffer baseBuffer)
at Microsoft.VisualStudio.Text.Projection.Implementation.ProjectionBuffer.CreateEdit(EditOptions options, Nullable`1 reiteratedVersionNumber, Object editTag)
at Microsoft.VisualStudio.Text.Operations.Implementation.EditorOperations.InsertText(String text, Boolean final, String undoText, Boolean isOverwriteModeEnabled)
at Microsoft.VisualStudio.Text.Operations.Implementation.EditorOperations.InsertText(String text, Boolean final)
at Microsoft.VisualStudio.Text.Operations.Implementation.EditorOperations.InsertText(String text)
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.InsertChar(IntPtr pvaIn, Boolean provisionalText)
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.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 Microsoft.VisualStudio.Editor.Implementation.Undo.UndoManagerCommandFilter.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Editor.Implementation.VerticalDetail.VerticalContentCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Editor.Implementation.Find.FindCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Editor.Implementation.IntellisenseCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Editor.Implementation.BraceCompletionCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Html.Package.Commands.Html.HtmlTextViewFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, 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 Microsoft.VisualStudio.Html.Interop.OleToCommandTargetShim.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg)
at Microsoft.Web.Editor.Controller.Controller.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg)
at Microsoft.Web.Editor.Controller.ViewController.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg)
at Microsoft.Html.Editor.Commands.HtmlMainController.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg)
at Microsoft.VisualStudio.Html.Interop.CommandTargetToOleShim.Exec(Guid& guidCommandGroup, UInt32 commandID, UInt32 commandExecOpt, IntPtr variantIn, IntPtr variantOut)
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 DotVVM.VS2015Extension.Bases.Commands.BaseCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in ...
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 DotVVM.VS2015Extension.Bases.Commands.BaseCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in ...
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 DotVVM.VS2015Extension.Bases.Commands.BaseCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in ...
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 DotVVM.VS2015Extension.Bases.Commands.BaseCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in ...
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 DotVVM.VS2015Extension.Bases.Commands.BaseCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in ...
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 DotVVM.VS2015Extension.Bases.Commands.BaseCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) in ...
at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam)
at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args)
at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c.<DispatchTextInputEvents>b__6_0(KeyProcessor p, TextCompositionEventArgs args)
at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c__DisplayClass10_1`1.<Dispatch>b__0()
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
我得到了同样的错误。关闭并重新打开VS是我发现的唯一有效的解决方案。。。
HTH、