Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug adapter process has terminated unexpectedly, when Wait-Process completes #168

Closed
swinster opened this issue May 7, 2016 · 6 comments
Assignees
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@swinster
Copy link

swinster commented May 7, 2016

Again, sorry guys, I do not know if this is a VSCode bug or the PowerShell Extension bug, so I will start here:

The Codes is relativity simple:

$proc = Start-Process $PathToExe -ArgumentList $ArgList
Wait-Process $proc.Id

When you run this in the Debugger, when the $proc process finished, the Debugger terminates unexpectedly.

@rkeithhill
Copy link
Contributor

rkeithhill commented May 9, 2016

Thanks. I was able to repro it. The exception info is:

5/8/2016 11:15:49 PM [ERROR] - Method "CurrentDomain_UnhandledException" at line 125 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Host\Program.cs

    FATAL UNHANDLED EXCEPTION:

    System.Management.Automation.ExtendedTypeSystemException: The following exception occurred while retrieving the string: "Process has exited, so the requested information is not available." ---> System.InvalidOperationException: Process has exited, so the requested information is not available.
       at System.Diagnostics.Process.EnsureState(State state)
       at System.Diagnostics.Process.get_ProcessName()
       at System.Diagnostics.Process.ToString()
       at System.Management.Automation.PSObject.ToString(ExecutionContext context, Object obj, String separator, String format, IFormatProvider formatProvider, Boolean recurse, Boolean unravelEnumeratorOnRecurse)
       --- End of inner exception stack trace ---
       at System.Management.Automation.PSObject.ToString(ExecutionContext context, Object obj, String separator, String format, IFormatProvider formatProvider, Boolean recurse, Boolean unravelEnumeratorOnRecurse)
       at System.Management.Automation.PSObject.ToString()
       at Microsoft.PowerShell.EditorServices.VariableDetails.GetValueString(Object value, Boolean isExpandable)
       at Microsoft.PowerShell.EditorServices.VariableDetails..ctor(String name, Object value)
       at Microsoft.PowerShell.EditorServices.DebugService.<FetchVariableContainer>d__25.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 Microsoft.PowerShell.EditorServices.DebugService.<FetchGlobalAndScriptVariables>d__24.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 Microsoft.PowerShell.EditorServices.DebugService.<FetchStackFramesAndVariables>d__23.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 Microsoft.PowerShell.EditorServices.DebugService.<OnDebuggerStop>d__35.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(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()

Looks like another place where we need to tolerate an exception when retrieving the value of an object in the debugger.

@rkeithhill rkeithhill added the Issue-Bug A bug to squash. label May 9, 2016
@rkeithhill rkeithhill self-assigned this May 9, 2016
@rkeithhill rkeithhill added this to the 0.6.0 milestone May 10, 2016
@daviwil daviwil added the Needs: Fix Verification Please verify the fix for us! label May 10, 2016
@daviwil
Copy link
Contributor

daviwil commented May 10, 2016

Hmmm, I can't get Start-Process to return anything other than null so Wait-Process doesn't work for me. How did you repro this @rkeithhill? Just trying to verify that it works on my side before I close the bug.

@rkeithhill
Copy link
Contributor

The repro code is (inserted into DebugTest.ps1:

$pathToExe = 'Notepad.exe'
$proc = Start-Process $PathToExe -PassThru
Wait-Process -Id $proc.Id

Do-Work 50 # breakpoint set here

When this works, you will see this variable value in the variables view when the breakpoint is hit:
pses-is168

@daviwil
Copy link
Contributor

daviwil commented May 11, 2016

Thanks! -PassThru is what I was missing. I've verified that this has been fixed after Keith's fix in PowerShellEditorServices today. I'll close this bug once 0.6.0 has been released.

@daviwil daviwil removed the Needs: Fix Verification Please verify the fix for us! label May 11, 2016
@swinster
Copy link
Author

Have you added the -passthrough parameter?

Get Outlook for Androidhttps://aka.ms/ghei36

On Tue, May 10, 2016 at 4:48 PM -0700, "David Wilson" <notifications@github.commailto:notifications@github.com> wrote:

Hmmm, I can't get Start-Process to return anything other than null so Wait-Process doesn't work for me. How did you repro this @rkeithhillhttps://github.com/rkeithhill? Just trying to verify that it works on my side before I close the bug.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/168#issuecomment-218324924

@daviwil
Copy link
Contributor

daviwil commented May 13, 2016

0.6.0 is now released! Let us know if you run into any further trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants