private void SetAll(UpdateException action, IDebugSession150 session) { var topExceptions = GetExceptions(null, session); List <EXCEPTION_INFO150> updated = new List <EXCEPTION_INFO150>(); for (int i = 0; i < topExceptions.Length; i++) { action(ref topExceptions[i], out bool changed); if (changed) { updated.Add(topExceptions[i]); } } if (updated.Any()) { session.SetExceptions(new ExceptionInfoEnumerator2017(updated.ToList())); updated.Clear(); } List <EXCEPTION_INFO150> allChildren = new List <EXCEPTION_INFO150>(); foreach (var topException in topExceptions) { var childExceptions = GetExceptions(topException, session); for (int i = 0; i < childExceptions.Count(); i++) { action(ref childExceptions[i], out bool changed); if (changed) { updated.Add(childExceptions[i]); } } allChildren.AddRange(childExceptions); } if (updated.Any()) { session.SetExceptions(new ExceptionInfoEnumerator2017(updated.ToList())); } }
private EXCEPTION_INFO150[] GetExceptions(EXCEPTION_INFO150?parent, IDebugSession150 session) { uint num = 0u; EXCEPTION_INFO150[] array = (EXCEPTION_INFO150[])((!parent.HasValue) ? null : new EXCEPTION_INFO150[1] { parent.Value }); IEnumDebugExceptionInfo150 val = default(IEnumDebugExceptionInfo150); EXCEPTION_INFO150[] array2; if (session.EnumDefaultExceptions(array, out val) == 0 && val != null) { uint num2 = default(uint); val.GetCount(out num2); array2 = (EXCEPTION_INFO150[])new EXCEPTION_INFO150[num2]; val.Next(num2, array2, ref num); } else { array2 = (EXCEPTION_INFO150[])new EXCEPTION_INFO150[0]; } return(array2); }