Пример #1
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;
            }
        }
        /// <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)
        {
            GetDebuggingService().OnBeforeDebuggingStateChanged(DebuggingState.Design, DebuggingState.Run);
            _disabled = (flags & DebugSessionFlags.EditAndContinueDisabled) != 0;

            if (_disabled)
            {
                return;
            }

            try
            {
                var workspace         = _workspaceProvider.Value.Workspace;
                var solution          = GetCurrentCompileTimeSolution();
                var openedDocumentIds = workspace.GetOpenDocumentIds().ToImmutableArray();
                var proxy             = new RemoteEditAndContinueServiceProxy(workspace);

                _debuggingSession = await proxy.StartDebuggingSessionAsync(
                    solution,
                    _debuggerService.Value,
                    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;
        }
        /// <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();
                _debuggingSession = await _proxy.StartDebuggingSessionAsync(solution, _debuggerService, captureMatchingDocuments : 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;
        }