예제 #1
0
        protected override DisconnectResponse HandleDisconnectRequest(DisconnectArguments arguments)
        {
            debugged.Close();
            debugged = null;

            return(new DisconnectResponse());
        }
예제 #2
0
 protected override DisconnectResponse HandleDisconnectRequest(DisconnectArguments arguments)
 {
     Enabled = false;
     Status  = StatusType.Stop;
     _resetEvent.Set();
     return(new DisconnectResponse());
 }
예제 #3
0
        protected override DisconnectResponse HandleDisconnectRequest(DisconnectArguments arguments)
        {
            this.currentLineNum = this.lines.Count + 1;
            this.Continue(step: false);

            // Ensure the debug thread has stopped before sending the response
            this.debugThread.Join();

            return(new DisconnectResponse());
        }
예제 #4
0
        public async Task <DisconnectResponse> Handle(DisconnectArguments request, CancellationToken cancellationToken)
        {
            // TODO: We need to sort out the proper order of operations here.
            //       Currently we just tear things down in some order without really checking what the debugger is doing.
            //       We should instead ensure that the debugger is in some valid state, lock it and then tear things down

            _debugEventHandlerService.UnregisterEventHandlers();

            if (!_debugStateService.ExecutionCompleted)
            {
                _debugStateService.ExecutionCompleted = true;
                _debugService.Abort();

                if (_debugStateService.IsInteractiveDebugSession && _debugStateService.IsAttachSession)
                {
                    // Pop the sessions
                    if (_runspaceContext.CurrentRunspace.RunspaceOrigin == RunspaceOrigin.EnteredProcess)
                    {
                        try
                        {
                            await _executionService.ExecutePSCommandAsync(
                                new PSCommand().AddCommand("Exit-PSHostProcess"),
                                CancellationToken.None).ConfigureAwait(false);

                            if (_debugStateService.IsRemoteAttach &&
                                _runspaceContext.CurrentRunspace.RunspaceOrigin == RunspaceOrigin.EnteredProcess)
                            {
                                await _executionService.ExecutePSCommandAsync(
                                    new PSCommand().AddCommand("Exit-PSSession"),
                                    CancellationToken.None).ConfigureAwait(false);
                            }
                        }
                        catch (Exception e)
                        {
                            _logger.LogException("Caught exception while popping attached process after debugging", e);
                        }
                    }
                }
                _debugService.IsClientAttached = false;
            }

            _logger.LogInformation("Debug adapter is shutting down...");

#pragma warning disable CS4014
            // Trigger the clean up of the debugger. No need to wait for it nor cancel it.
            Task.Run(_psesDebugServer.OnSessionEnded, CancellationToken.None);
#pragma warning restore CS4014

            return(new DisconnectResponse());
        }
        public async Task <DisconnectResponse> Handle(DisconnectArguments request, CancellationToken cancellationToken)
        {
            _debugEventHandlerService.UnregisterEventHandlers();
            if (_debugStateService.ExecutionCompleted == false)
            {
                _debugStateService.ExecutionCompleted = true;
                _powerShellContextService.AbortExecution(shouldAbortDebugSession: true);

                if (_debugStateService.IsInteractiveDebugSession && _debugStateService.IsAttachSession)
                {
                    // Pop the sessions
                    if (_powerShellContextService.CurrentRunspace.Context == RunspaceContext.EnteredProcess)
                    {
                        try
                        {
                            await _powerShellContextService.ExecuteScriptStringAsync("Exit-PSHostProcess").ConfigureAwait(false);

                            if (_debugStateService.IsRemoteAttach &&
                                _powerShellContextService.CurrentRunspace.Location == RunspaceLocation.Remote)
                            {
                                await _powerShellContextService.ExecuteScriptStringAsync("Exit-PSSession").ConfigureAwait(false);
                            }
                        }
                        catch (Exception e)
                        {
                            _logger.LogException("Caught exception while popping attached process after debugging", e);
                        }
                    }
                }

                _debugService.IsClientAttached = false;
            }

            _logger.LogInformation("Debug adapter is shutting down...");

#pragma warning disable CS4014
            // Trigger the clean up of the debugger. No need to wait for it.
            Task.Run(_psesDebugServer.OnSessionEnded);
#pragma warning restore CS4014

            return(new DisconnectResponse());
        }
예제 #6
0
 protected override DisconnectResponse HandleDisconnectRequest(DisconnectArguments arguments)
 {
     HostWindowCTS.Cancel();
     HostTask.Wait();
     return(new DisconnectResponse());
 }
예제 #7
0
 protected override DisconnectResponse HandleDisconnectRequest(DisconnectArguments arguments)
 {
     return(new DisconnectResponse());
 }