int IDebugProperty2.EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) { IEnumerable<DebugEvaluationResult> children = _children.Value; if (!RToolsSettings.Current.ShowDotPrefixedVariables) { children = children.Where(v => v.Name != null && !v.Name.StartsWith(".")); } if (IsFrameEnvironment) { children = children.OrderBy(v => v.Name); } var infos = children.Select(v => new AD7Property(this, v).GetDebugPropertyInfo(dwRadix, dwFields)); var valueResult = EvaluationResult as DebugValueEvaluationResult; if (valueResult != null && valueResult.HasAttributes == true) { string attrExpr = Invariant($"base::attributes({valueResult.Expression})"); var attrResult = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.EvaluateAsync(attrExpr, "attributes()", reprMaxLength: ReprMaxLength, cancellationToken:ct)); if (!(attrResult is DebugErrorEvaluationResult)) { var attrInfo = new AD7Property(this, attrResult, isSynthetic: true).GetDebugPropertyInfo(dwRadix, dwFields); infos = new[] { attrInfo }.Concat(infos); } } ppEnum = new AD7PropertyInfoEnum(infos.ToArray()); return VSConstants.S_OK; }
int IDebugExpression2.EvaluateAsync(enum_EVALFLAGS dwFlags, IDebugEventCallback2 pExprCallback) { _cts = new CancellationTokenSource(); Task.Run(async () => { try { var res = await StackFrame.StackFrame.EvaluateAsync(_expression, reprMaxLength: AD7Property.ReprMaxLength); _cts.Token.ThrowIfCancellationRequested(); var prop = new AD7Property(StackFrame, res); StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(this, prop), AD7ExpressionEvaluationCompleteEvent.IID); } catch (Exception ex) when (!ex.IsCriticalException()) { StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(ex), AD7ExpressionEvaluationCompleteEvent.IID); } finally { _cts = null; } }); return VSConstants.S_OK; }
int IDebugExpression2.EvaluateAsync(enum_EVALFLAGS dwFlags, IDebugEventCallback2 pExprCallback) { _cts = new CancellationTokenSource(); Task.Run(async() => { try { var res = await StackFrame.StackFrame.EvaluateAsync(_expression, AD7Property.PrefetchedFields, AD7Property.ReprMaxLength); _cts.Token.ThrowIfCancellationRequested(); var prop = new AD7Property(StackFrame, res); StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(this, prop), AD7ExpressionEvaluationCompleteEvent.IID); } catch (Exception ex) when(!ex.IsCriticalException()) { StackFrame.Engine.Send(new AD7ExpressionEvaluationCompleteEvent(ex), AD7ExpressionEvaluationCompleteEvent.IID); } finally { _cts = null; } }); return(VSConstants.S_OK); }
public AD7Property(AD7Property parent, DebugEvaluationResult result, bool isSynthetic = false) : this(parent.StackFrame, result, isSynthetic, false) { Parent = parent; }
int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { var res = TaskExtensions.RunSynchronouslyOnUIThread(ct => StackFrame.StackFrame.EvaluateAsync(_expression, reprMaxLength: AD7Property.ReprMaxLength, cancellationToken:ct)); ppResult = new AD7Property(StackFrame, res); return VSConstants.S_OK; }