1

Closed

Clear screen in Python Debug Interactive window causes exception

description

From 5/28 BB.
PTVS build: PTVS build \pytools\RollData\PTVS\Build\PTVS\CL1265380
VS build: VS 2013 Ultimate with update 2
Python: 3.3 and 3.4 (3.4 was installed through the Azure SDK 0.8.0 for Python)
OS: Win8.1 CHS

Repro Step:
  1. Create a Bottle Web project
  2. Create a 3.4 virtual environment
  3. F5
  4. Create a 3.4 virtual environment for publish
  5. In the Publish dialog make sure to select "Debug" so you can remote debug
  6. Publish
    6.5 As a workaround of another issue, you may need to restart the website in Portal.
  7. In the Server explorer, attach a debugger (python)
  8. Set a breakpoint somewhere in the code and trigger the breakpoint
  9. Open the Python Debug Interactive window
  10. Execute something in the interactive window (this actually causes the following error: Current interactive window is disconnected - please reset the process.
  11. Click on the Clear Screen button
Actual Result:
An exception is thrown. Below is the stack trace:

ERROR Unhandled exception in Microsoft.PythonTools.Intellisense.TaskProvider.Refresh (c:\RollBuild\Python\Product\PythonTools\PythonTools\Intellisense\TaskProvider.cs:458) System.ArgumentException: The specified ITextSnapshot doesn't belong to the correct TextBuffer. at Microsoft.VisualStudio.Text.Implementation.TrackingSpan.GetSpan(ITextSnapshot snapshot) at Microsoft.VisualStudio.Text.Tagging.SimpleTagger1.EndBatch() at Microsoft.VisualStudio.Text.Tagging.SimpleTagger1.CreateTagSpan(ITrackingSpan span, T tag) at Microsoft.PythonTools.Intellisense.TaskProviderItem.<>c__DisplayClass1.<ToSquiggleFunc>b__0(SimpleTagger1 c) at Microsoft.PythonTools.Intellisense.TaskProvider.<>c__DisplayClasse.<RefreshAsync>b__9() at Microsoft.VisualStudioTools.UIThread.InvokeAsyncHelper(Action action, TaskCompletionSource1 tcs) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.PythonTools.Intellisense.TaskProvider.<RefreshAsync>d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.VisualStudioTools.TaskExtensions.<HandleAllExceptions>d__7.MoveNext() Python Tools for Visual Studio 2014/05/28 23:33:00.375

ERROR System.ArgumentException: The specified ITextSnapshot doesn't belong to the correct TextBuffer. at Microsoft.VisualStudio.Text.Implementation.TrackingSpan.GetSpan(ITextSnapshot snapshot) at Microsoft.VisualStudio.Text.Tagging.SimpleTagger1.<GetTags>d__c.MoveNext() at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator1.<GetTagsForBuffer>d__5.MoveNext() Editor or Editor Extension 2014/05/28 23:33:38.001

You probably don't need to go through all the steps to repro the problem. I just wanted to make sure this is one of the path that trigged the exception for regression purposes.
Closed Sep 5 at 9:53 PM by jinglou
Verified this in RC and 20904.03. Closing.

comments

dinov wrote Jun 17 at 10:30 PM

The repro for this is simpler. Open an interactive window, type:
aa bb
And press enter. Wait for the squiggles to appear. Then on the next line of input type:
cc dd

And wait a 2nd and you should hit it.

The underlying issue is that the TaskProvider is only tracking the 1st buffer for the REPL window and trying to create a tracking span against that buffer instead of the correct buffer.