1

Resolved

BasePythonReplEvaluator.HandleReadLine may have null Stream

description

While running tests, had a crash in Release\Product\Python\PythonTools\PythonTools\Repl\BasePythonReplEvaluator.cs where Stream is captured, but never null checked.

We either need to null check before using Stream or capture the stream before queuing the work item.

comments

Zooba wrote Feb 18 at 11:21 PM

Possibly related stack trace:

An unhandled exception is about to terminate the process. Exception info:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.PythonTools.Debugger.Extensions.Write(Stream stream, Byte[] b) in c:\PTVS\Open_Source\Feature\Python_2.0\Release\Product\Python\Debugger\Debugger\Extensions.cs:line 124
at Microsoft.PythonTools.Repl.BasePythonReplEvaluator.CommandProcessorThread.<HandleReadLine>b__e(Object x) in c:\PTVS\Open_Source\Feature\Python_2.0\Release\Product\Python\PythonTools\PythonTools\Repl\BasePythonReplEvaluator.cs:line 349
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
at Microsoft.PythonTools.Project.UIThread.<Initialize>b__6(Object sender, UnhandledExceptionEventArgs args) in c:\PTVS\Open_Source\Feature\Python_2.0\Release\Product\Python\PythonTools\PythonTools\Project\UIThread.cs:line 192
at Microsoft.PythonTools.Debugger.Extensions.Write(Stream stream, Byte[] b) in c:\PTVS\Open_Source\Feature\Python_2.0\Release\Product\Python\Debugger\Debugger\Extensions.cs:line 124
at Microsoft.PythonTools.Repl.BasePythonReplEvaluator.CommandProcessorThread.<HandleReadLine>b__e(Object x) in c:\PTVS\Open_Source\Feature\Python_2.0\Release\Product\Python\PythonTools\PythonTools\Repl\BasePythonReplEvaluator.cs:line 349
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Zooba wrote Feb 27 at 4:12 PM

Fixed in 2.0 feature branch.