none
VS 2017 error: "Attempted TextBuffer edit operation while another edit is in progress"

    Question

  • I´m randomly getting the error message

    "Attempted TextBuffer edit operation while another edit is in progress"

    when trying to edit a source file. The file then remains inaccessible until I restart Visual Studio.

    Wednesday, November 30, 2016 3:24 PM

Answers

  • Hi SPALACIO,

    According to the error message, the source file that you are editing seem also edit by another process. Please check whether there has any other programs occupied this file too.

    Do you have this issue after installing Visual Studio 2017 or after using for a while?

    If it occurs after using for a while, I suggest you check whether you install any VS packages for your Visual Studio. Please disable/uninstall these VS packages to check whether this issue cause by the VS packages.

    And please try reset your Visual Studio settings through Tools -> Import and Export settings -> Reset all settings.

    If this issue occurs after installing Visual Studio, I'm afraid that there has installation problem on it. Please try repair your Visual Studio.

    In addition, this issue occurs randomly. I suggest you try check whether there has any regular when it occurs, which is benefit to us find out what happened.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 01, 2016 7:35 AM
    Moderator

All replies

  • Hi SPALACIO,

    According to the error message, the source file that you are editing seem also edit by another process. Please check whether there has any other programs occupied this file too.

    Do you have this issue after installing Visual Studio 2017 or after using for a while?

    If it occurs after using for a while, I suggest you check whether you install any VS packages for your Visual Studio. Please disable/uninstall these VS packages to check whether this issue cause by the VS packages.

    And please try reset your Visual Studio settings through Tools -> Import and Export settings -> Reset all settings.

    If this issue occurs after installing Visual Studio, I'm afraid that there has installation problem on it. Please try repair your Visual Studio.

    In addition, this issue occurs randomly. I suggest you try check whether there has any regular when it occurs, which is benefit to us find out what happened.

    Best Regards,
    Weiwei


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 01, 2016 7:35 AM
    Moderator
  • Thanks for answer, I had this issue after using for a while...I repaired  my Visual Studio, and for now everything works fine.

    Thanks

    Wednesday, December 14, 2016 2:12 PM
  • I am having this too, and it repeats after a new install of VS 2017. It is random, and seems to occur when I am doing a number of text changes/deletes after each other. Stopping and starting VS helps. Once this occurs, I am no longer able to edit anything, until I stop and restart.

    It does not happen frequently, once per two weeks or so, when working full time with VS
    Thursday, May 04, 2017 8:13 AM
  • I'm having the same issue. 

    Seems like ServiceHub.RoslynCodeAnalysisService32.exe is locking down the text editor. Seems like another bug. 

    • Proposed as answer by mts_egy Monday, July 10, 2017 6:10 PM
    Friday, May 12, 2017 2:33 PM
  • Yea, I am seeing the same thing on version 15.2 (26430.6) Release (the newest available as of the date of writing). Strange how such bugs slips into production releases.
    Monday, May 15, 2017 8:29 PM
  • close the file, reopen it. 

    regardless of what else is going on, this is a bug and I hope it gets fixed. 

    I have not had to restart vs yet to resolve. just close open the file 

    Wednesday, May 24, 2017 5:46 PM
  • Experiencing this issue. Closing the file and opening it again solves it, but it happens very regularly.  Almost at the point of abandoning 2017 as a result. Version 15.2 (26430.14)
    • Edited by WCGRP Wednesday, June 28, 2017 5:32 PM added version
    Wednesday, June 28, 2017 5:29 PM
  • I hope I can help with this:
    I'd been working with VS'17 -15.2(26430.4) since May with ABSOLUTLY no problems.  This is until about two days ago, I had a collapsed section of code that I wanted to move from one function into a whole new function.  Probably a common pattern, I'm guessing.  When I hit CTRL-X, VS kind of hung and then reported an error about Undo being unavailable or disabled.  I remember the message was specifically about undo.  And that was the only time I saw that message, but it seems to be what triggered the issue being discussed here. 

    Since then I have been receiving the subject error pretty frequently.  I honestly haven't intentionally TRIED to reproduce the error, but I've seen it enough that I am confident that it happens anytime there is misalignment in a code block.  For example, and the final straw that made me seek help, I had semi-long Select Case (two long to try to copy and paste un-collapsed), that I knew could throw and exception.  So I wanted to wrap it in a Try-Catch.  I already had a canned exception handler in another sub; so I copied it and pasted in after the End Select.  OK thumbs up.  But now there is the Select Case FOLLOWED by a Catch and the End Try.  When I scrolled up (actually using the up arrow key) to get to the top of the Select, the moment I got to the line to type Try, BOOM.  I got the subject error. 

    I don't know the inner workings of VS obviously, but it seems to me that its related to some of the code checking process, like the text checker got stuck and was like, "Whoa, this dude has a Catch way down at the bottom of all this code and no Try.  I've never seen that before!"  I can't say its limited to Selects, but for me at least, the error arises when I'm wrapping a block of code and for a moment there is a Try without Catch and End or If without end.

    I hope that helps narrow it down.  I will try repairing my installation soon and see if that helps.


    • Edited by BtLoper Friday, July 07, 2017 4:16 PM minor clarification
    Friday, July 07, 2017 4:13 PM
  • This happened to me for the first time this morning (8/2/17); doing "File|Close" and then "ViewCode" seems to have corrected the problem, at least for the moment.
    Wednesday, August 02, 2017 4:32 PM
  • I'm getting this error every time after Format Document (Ctrl+K, Ctrl+D). Version 15.3.5.
    Thursday, October 19, 2017 9:18 AM
  • I keep getting this at regular intervals.

    It tends to be in large code behind files with lots of edits and usually occurs when I delete the "if" section of an "if then else" block when I want to remove the if condition.

    Once it starts it keeps repeating.

    To overcome it I started to delete second part of the block first : ie delete the "else" section first and then delete the "if" statement.

    HTH

    Thursday, November 02, 2017 4:56 PM
  • If you close the specific tab and reopen it, that might do it... because it doesn't seem to carry over to other files in the project since each file has it's own buffer. Closing it should release the buffer.
    Tuesday, November 21, 2017 2:47 PM
  • I just had this error pop up in v15.5.2. I was just editing code as normal when the error occurred. Had to restart to keep working.
    Thursday, December 21, 2017 3:22 PM