9

Exceptions Thrown:

  • The specified SnapshotPoint or SnapshotSpan is on a different ITextSnapshot than this SnapshotSpan.
  • Attempted TextBuffer edit operation while another edit is in progress
  • Index was outside the bounds of the array

Attempted TextBuffer edit operation while another edit is in progress

Index was outside the bounds of the array

I currently have open a .ascx file and I was in the process of editing some html code that contained Knockout.js data-bind's. When editing the text in the file I was greeted by the above error and I am unable to backspace, delete, or edit the code. The Visual Studio text editor shifted all the colors as if it had no idea what code was on the screen.

Code in question:

<div class="paging item-pad-top clearfix">
   <ul>
      <li><a href="#" data-bind="click: grouped.moveFirst">«</a></li>           
          <!-- ko foreach: new Array(grouped.pageCount()) -->
              <<li>
                   <a data-bind='text: $index() + 1'/>
              </li>
          <!-- /ko -->
      <li><a href="#" data-bind="click: grouped.moveLast">»</a></li>   
   </ul>
</div>

Note that the second li has TWO < characters. I am unable to remove this second character.

I am running as administrator. I cannot edit any other code on this page.

4
  • Can you edit this file in a different text editor?
    – Jasen
    Jan 22, 2014 at 17:35
  • @Jasen Yes. But it needs to remain in Visual Studio and TFS for Source Control. Editing this file in Notepad++ has stopped the error from taking place. Odd. Jan 22, 2014 at 18:16
  • That might indicate a corrupted file.
    – Jasen
    Jan 22, 2014 at 18:20
  • @Jasen Does this mean I need to copy and paste the entire contents into a new file and add that new file to TFS? Not too complicated. Jan 22, 2014 at 19:03

1 Answer 1

14

This error sometimes comes after the ActivityLog.xml file for the particular file you are editing gets corrupted. I have encountered the error a few times and from what it seems, ActivityLog.xml handles all the text edit operations for the associated file.

Closing and opening the file again should resolve the issue as it always did for mine.

2
  • 1
    I don't have a way to test this anymore, but thank you for the information! Hopefully it works for somebody in the future. Apr 9, 2015 at 2:43
  • Restarting the visual studio solved my problem too. Thanks :) Jun 28, 2017 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.