/// <summary>
        /// Called by the debugger when a debugging session starts and managed debugging is being used.
        /// </summary>
        public async Task StartDebuggingAsync(DebugSessionFlags flags, CancellationToken cancellationToken)
        {
            _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run);
            _disabled = (flags & DebugSessionFlags.EditAndContinueDisabled) != 0;

            if (_disabled)
            {
                return;
            }

            try
            {
                var solution          = GetCurrentCompileTimeSolution();
                var openedDocumentIds = _proxy.Workspace.GetOpenDocumentIds().ToImmutableArray();

                _debuggingSession = await _proxy.StartDebuggingSessionAsync(
                    solution,
                    _debuggerService,
                    captureMatchingDocuments : openedDocumentIds,
                    captureAllMatchingDocuments : false,
                    reportDiagnostics : true,
                    cancellationToken).ConfigureAwait(false);
            }
            catch (Exception e) when(FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken))
            {
            }

            // the service failed, error has been reported - disable further operations
            _disabled = _debuggingSession == null;
        }
Beispiel #2
0
        /// <summary>
        /// Called by the debugger when a debugging session starts and managed debugging is being used.
        /// </summary>
        public async Task StartDebuggingAsync(
            DebugSessionFlags flags,
            CancellationToken cancellationToken
            )
        {
            _debuggingService.OnBeforeDebuggingStateChanged(
                DebuggingState.Design,
                DebuggingState.Run
                );
            _disabled = (flags & DebugSessionFlags.EditAndContinueDisabled) != 0;

            if (_disabled)
            {
                return;
            }

            try
            {
                var solution = _proxy.Workspace.CurrentSolution;
                _debuggingSessionConnection = await _proxy
                                              .StartDebuggingSessionAsync(
                    solution,
                    _debuggerService,
                    captureMatchingDocuments : false,
                    cancellationToken
                    )
                                              .ConfigureAwait(false);
            }
            catch (Exception e) when(FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken))
            {
                _disabled = true;
            }
        }
        public void StartDebugging(DebugSessionOptions options)
        {
            _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run);

            if ((options & DebugSessionOptions.EditAndContinueDisabled) == 0)
            {
                _encService = _workspace.Services.GetRequiredService <IEditAndContinueWorkspaceService>();

                // hook up a callbacks (the call blocks until the message is processed):
                using (DebuggerComponent.ManagedEditAndContinueService())
                {
                    DkmCustomMessage.Create(
                        Connection: null,
                        Process: null,
                        SourceId: DebuggerService.MessageSourceId,
                        MessageCode: 0,
                        Parameter1: _encService,
                        Parameter2: null).SendLower();
                }

                _encService.StartDebuggingSession();
            }
            else
            {
                _encService = null;
            }
        }
        public void StartDebugging(DebugSessionOptions options)
        {
            _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run);

            if ((options & DebugSessionOptions.EditAndContinueDisabled) == 0)
            {
                _encService = _workspace.Services.GetRequiredService <IEditAndContinueWorkspaceService>();
                _encService.StartDebuggingSession(_workspace.CurrentSolution);
            }
            else
            {
                _encService = null;
            }
        }
        /// <summary>
        /// Called by the debugger when a debugging session starts and managed debugging is being used.
        /// </summary>
        public void StartDebugging()
        {
            // Hook up a callbacks (the call blocks until the message is processed).
            using (DebuggerComponent.ManagedEditAndContinueService())
            {
                DkmCustomMessage.Create(
                    Connection: null,
                    Process: null,
                    SourceId: DebuggerService.MessageSourceId,
                    MessageCode: 0,
                    Parameter1: this,
                    Parameter2: null).SendLower();
            }

            _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run);

            _encService.StartDebuggingSession();
        }
#pragma warning restore

        /// <summary>
        /// Called by the debugger when a debugging session starts and managed debugging is being used.
        /// </summary>
        public async Task StartDebuggingAsync(Dbg.DebugSessionOptions options, CancellationToken cancellationToken)
        {
            _debuggingService.OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run);
            _disabled = (options & Dbg.DebugSessionOptions.EditAndContinueDisabled) != 0;

            if (_disabled)
            {
                return;
            }

            try
            {
                var solution = _proxy.Workspace.CurrentSolution;
                await _proxy.StartDebuggingSessionAsync(solution, cancellationToken).ConfigureAwait(false);
            }
            catch (Exception e) when(FatalError.ReportAndCatchUnlessCanceled(e))
            {
                _disabled = true;
            }
        }