public void EvaluateVisualizedExpression(DkmVisualizedExpression visualizedExpression, out DkmEvaluationResult resultObject) { var rootExpr = visualizedExpression as DkmRootVisualizedExpression; if (rootExpr == null) { Debug.Fail("PythonViewNativeVisualizer.EvaluateVisualizedExpression was given a visualized expression that is not a DkmRootVisualizedExpression."); throw new NotSupportedException(); } DkmEvaluationResult rawResult; RawEvaluationResultHolder rawResultHolder; using (var rawExpr = DkmLanguageExpression.Create(CppExpressionEvaluator.CppLanguage, DkmEvaluationFlags.ShowValueRaw, rootExpr.FullName + ",!", null)) { rootExpr.EvaluateExpressionCallback(rootExpr.InspectionContext, rawExpr, rootExpr.StackFrame, out rawResult); rawResultHolder = new RawEvaluationResultHolder { RawResult = rawResult }; rootExpr.SetDataItem(DkmDataCreationDisposition.CreateAlways, rawResultHolder); } var rawSuccessResult = rawResult as DkmSuccessEvaluationResult; if (rawSuccessResult != null) { resultObject = DkmSuccessEvaluationResult.Create( rawResult.InspectionContext, rawResult.StackFrame, rootExpr.Name, rawSuccessResult.FullName, rawSuccessResult.Flags, rawSuccessResult.Value, rawSuccessResult.EditableValue, rawSuccessResult.Type, rawSuccessResult.Category, rawSuccessResult.Access, rawSuccessResult.StorageType, rawSuccessResult.TypeModifierFlags, rawSuccessResult.Address, rawSuccessResult.CustomUIVisualizers, rawSuccessResult.ExternalModules, rawResultHolder); return; } var rawFailedResult = rawResult as DkmFailedEvaluationResult; if (rawFailedResult != null) { resultObject = DkmFailedEvaluationResult.Create( rawResult.InspectionContext, rawResult.StackFrame, rootExpr.Name, rootExpr.FullName, rawFailedResult.ErrorMessage, rawFailedResult.Flags, rawResultHolder); return; } Debug.Fail("Raw evaluation result was neither DkmSuccessEvaluationResult nor DkmFailedEvaluationResult."); throw new NotSupportedException(); }
public void EvaluateVisualizedExpression(DkmVisualizedExpression visualizedExpression, out DkmEvaluationResult resultObject) { var rootExpr = visualizedExpression as DkmRootVisualizedExpression; if (rootExpr == null) { Debug.Fail("PythonViewNativeVisualizer.EvaluateVisualizedExpression was given a visualized expression that is not a DkmRootVisualizedExpression."); throw new NotSupportedException(); } DkmEvaluationResult rawResult; RawEvaluationResultHolder rawResultHolder; using (var rawExpr = DkmLanguageExpression.Create(CppExpressionEvaluator.CppLanguage, DkmEvaluationFlags.ShowValueRaw, rootExpr.FullName + ",!", null)) { rootExpr.EvaluateExpressionCallback(rootExpr.InspectionContext, rawExpr, rootExpr.StackFrame, out rawResult); rawResultHolder = new RawEvaluationResultHolder { RawResult = rawResult }; rootExpr.SetDataItem(DkmDataCreationDisposition.CreateAlways, rawResultHolder); } var rawSuccessResult = rawResult as DkmSuccessEvaluationResult; if (rawSuccessResult != null) { resultObject = DkmSuccessEvaluationResult.Create( rawResult.InspectionContext, rawResult.StackFrame, rootExpr.Name, rawSuccessResult.FullName, rawSuccessResult.Flags, rawSuccessResult.Value, rawSuccessResult.EditableValue, rawSuccessResult.Type, rawSuccessResult.Category, rawSuccessResult.Access, rawSuccessResult.StorageType, rawSuccessResult.TypeModifierFlags, rawSuccessResult.Address, rawSuccessResult.CustomUIVisualizers, rawSuccessResult.ExternalModules, rawResultHolder); return; } var rawFailedResult = rawResult as DkmFailedEvaluationResult; if (rawFailedResult != null) { resultObject = DkmFailedEvaluationResult.Create( rawResult.InspectionContext, rawResult.StackFrame, rootExpr.Name, rootExpr.FullName, rawFailedResult.ErrorMessage, rawFailedResult.Flags, rawResultHolder); return; } Debug.Fail("Raw evaluation result was neither DkmSuccessEvaluationResult nor DkmFailedEvaluationResult."); throw new NotSupportedException(); }