private bool TryPopulateMember(object?o, DumpQuotas targetQuotas) { if (_member == null) { return(false); } object?value; try { if (o is Exception exception) { if (_member.Name == nameof(Exception.StackTrace)) { value = GetStackTrace(exception); } else { value = GetMemberValue(o); if (_member.Name == "TargetSite") { targetQuotas = targetQuotas.WithMaxDepth(0); } } } else { value = GetMemberValue(o); } } catch (TargetInvocationException exception) { Header = _member.Name; // ReSharper disable once PossibleNullReferenceException Value = $"Threw {exception.InnerException.GetType().Name}"; Children = new List <ResultObject> { ExceptionResultObject.Create(exception.InnerException, _quotas) }; return(true); } if (value == null) { if (_member is PropertyInfo propertyInfo) { SetType(propertyInfo.PropertyType); } else if (_member is FieldInfo fieldInfo) { SetType(fieldInfo.FieldType); } } PopulateObject(value, _member.Name, targetQuotas); return(true); }