Example #1
0
        public async Task <IVariableInformation> EvaluateExpressionLldbEvalAsync(
            string displayName, VsExpression vsExpression,
            IDictionary <string, RemoteValue> contextVariables = null)
        {
            RemoteValue resultValue = await _remoteValue.EvaluateExpressionLldbEvalAsync(
                vsExpression.Value, contextVariables);

            return(resultValue == null
                       ? null
                       : _varInfoBuilder.Create(resultValue, displayName,
                                                formatSpecifier: vsExpression.FormatSpecifier));
        }
        public void LldbEvalDontFallbackCommonErrors(LldbEvalErrorCode lldbEvalErrorCode)
        {
            _optionPageGrid.ExpressionEvaluationEngine =
                ExpressionEvaluationEngineFlag.LLDB_EVAL_WITH_FALLBACK;

            RemoteValue mockVariable = CreateMockVariable();
            RemoteValue errorValue   =
                RemoteValueFakeUtil.CreateLldbEvalError(lldbEvalErrorCode, "the error message");

            mockVariable
            .EvaluateExpressionLldbEvalAsync(Arg.Any <string>(),
                                             Arg.Any <IDictionary <string, RemoteValue> >())
            .Returns(errorValue);

            var exception = Assert.ThrowsAsync <ExpressionEvaluationFailed>(
                async() => await _evaluator.EvaluateExpressionAsync(
                    "2 + 2", _varInfoFactory.Create(mockVariable), new NatvisScope(), "result"));

            Assert.That(exception.Message, Does.Contain("the error message"));
        }
        public async Task LldbEvalWithFallbackAsync(LldbEvalErrorCode lldbEvalErrorCode)
        {
            _optionPageGrid.ExpressionEvaluationEngine =
                ExpressionEvaluationEngineFlag.LLDB_EVAL_WITH_FALLBACK;

            RemoteValue mockVariable = CreateMockVariable();
            RemoteValue errorValue   = RemoteValueFakeUtil.CreateLldbEvalError(lldbEvalErrorCode);
            var         natvisScope  = new NatvisScope();

            mockVariable
            .EvaluateExpressionLldbEvalAsync(Arg.Any <string>(),
                                             Arg.Any <IDictionary <string, RemoteValue> >())
            .Returns(errorValue);

            await _evaluator.EvaluateExpressionAsync("expr", _varInfoFactory.Create(mockVariable),
                                                     natvisScope, "result");

            await mockVariable.Received(1).EvaluateExpressionLldbEvalAsync(
                Arg.Is("expr"), Arg.Is(natvisScope.ContextVariables));

            mockVariable.DidNotReceiveWithAnyArgs().GetValueForExpressionPath(Arg.Any <string>());
            await mockVariable.Received(1).EvaluateExpressionAsync(Arg.Is("expr"));
        }
Example #4
0
 public async Task <RemoteValue> EvaluateExpressionLldbEvalAsync(
     string expression, IDictionary <string, RemoteValue> scratchVariables = null) =>
 await remoteProxy.EvaluateExpressionLldbEvalAsync(expression, scratchVariables);
 public async Task <RemoteValue> EvaluateExpressionLldbEvalAsync(
     string expression, IDictionary <string, RemoteValue> contextVariables = null) =>
 await value.EvaluateExpressionLldbEvalAsync(expression);