// Enumerates the children of a property. This provides support for dereferencing pointers, displaying members of an array, or fields of a class or struct. // The sample debugger only supports pointer dereferencing as children. This means there is only ever one child. public int EnumChildren(enum_DEBUGPROP_INFO_FLAGS dwFields, uint dwRadix, ref System.Guid guidFilter, enum_DBG_ATTRIB_FLAGS dwAttribFilter, string pszNameFilter, uint dwTimeout, out IEnumDebugPropertyInfo2 ppEnum) { ppEnum = null; try { var children = TaskHelpers.RunSynchronouslyOnUIThread(ct => { var timeoutToken = CancellationTokens.GetToken(TimeSpan.FromMilliseconds(dwTimeout)); var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(ct, timeoutToken); return(_evalResult.GetChildrenAsync(linkedSource.Token)); }); if (children != null) { DEBUG_PROPERTY_INFO[] properties = new DEBUG_PROPERTY_INFO[children.Length]; for (int i = 0; i < children.Length; i++) { properties[i] = new AD7Property(_frame, children[i], true).ConstructDebugPropertyInfo(dwRadix, dwFields); } ppEnum = new AD7PropertyEnum(properties); return(VSConstants.S_OK); } return(VSConstants.S_FALSE); } catch (OperationCanceledException) { return(VSConstants.S_FALSE); } }
// The debugger will call this when the user tries to edit the property's values in one of the debugger windows. public int SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout) { try { var result = TaskHelpers.RunSynchronouslyOnUIThread(async ct => { var timeoutToken = CancellationTokens.GetToken(TimeSpan.FromMilliseconds(dwTimeout)); var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(ct, timeoutToken); return(await _evalResult.Frame.ExecuteTextAsync(_evalResult.Expression + " = " + pszValue, ct: linkedSource.Token)); }); return(VSConstants.S_OK); } catch (OperationCanceledException) { return(VSConstants.E_FAIL); } }