public async Task <ExecutionResult> ExecuteCodeAsync(string text)
        {
            var cmdRes = _commands.TryExecuteCommand();

            if (cmdRes != null)
            {
                return(await cmdRes);
            }

            var thread = await EnsureConnectedAsync();

            if (thread != null)
            {
                ExecutionResult result = await thread.ExecuteText(text);

                try {
                    await _serviceProvider.GetUIThread().InvokeTask(async() => await _serviceProvider.RefreshVariableViewsAsync());
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    Debug.Fail(ex.ToString());
                }

                return(result);
            }

            WriteError(Strings.ReplDisconnected);
            return(ExecutionResult.Failure);
        }
Ejemplo n.º 2
0
        public Task <ExecutionResult> ExecuteCodeAsync(string text)
        {
            var res = _commands.TryExecuteCommand();

            if (res != null)
            {
                return(res);
            }

            if (!IsInDebugBreakMode())
            {
                NoExecutionIfNotStoppedInDebuggerError();
                return(ExecutionResult.Succeeded);
            }

            if (_activeEvaluator != null)
            {
                return(_activeEvaluator.ExecuteCodeAsync(text));
            }
            else
            {
                if (CustomDebugAdapterProtocolExtension.CanUseExperimental())
                {
                    var tid    = _serviceProvider.GetDTE().Debugger.CurrentThread.ID;
                    var result = CustomDebugAdapterProtocolExtension.EvaluateReplRequest(text, tid);
                    CurrentWindow.Write(result);
                }
            }

            return(ExecutionResult.Succeeded);
        }
Ejemplo n.º 3
0
        public Task <ExecutionResult> ExecuteCodeAsync(string text)
        {
            var res = _commands.TryExecuteCommand();

            if (res != null)
            {
                return(res);
            }

            if (!IsInDebugBreakMode())
            {
                NoExecutionIfNotStoppedInDebuggerError();
                return(ExecutionResult.Succeeded);
            }

            if (_activeEvaluator != null)
            {
                return(_activeEvaluator.ExecuteCodeAsync(text));
            }
            return(ExecutionResult.Succeeded);
        }
Ejemplo n.º 4
0
        public async Task <ExecutionResult> ExecuteCodeAsync(string text)
        {
            try
            {
                if (_interactiveCommands.InCommand)
                {
                    var cmdResult = _interactiveCommands.TryExecuteCommand();
                    if (cmdResult != null)
                    {
                        return(await cmdResult.ConfigureAwait(false));
                    }
                }

                var result = await _interactiveHost.ExecuteAsync(text).ConfigureAwait(false);

                if (result.Success)
                {
                    // We are not executing a command (the current content type is not "Interactive Command"),
                    // so the source document should not have been removed.
                    Debug.Assert(_workspace.CurrentSolution.GetProject(_currentSubmissionProjectId).HasDocuments);

                    // only remember the submission if we compiled successfully, otherwise we
                    // ignore it's id so we don't reference it in the next submission.
                    _previousSubmissionProjectId = _currentSubmissionProjectId;

                    // update local search paths - remote paths has already been updated
                    UpdateResolvers(result);
                }

                return(new ExecutionResult(result.Success));
            }
            catch (Exception e) when(FatalError.Report(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }