public void AddOrUpdate(ExceptionInfoKey key, bool breakOnFirstChance, bool isOtherExceptions) { if (isOtherExceptions) { int index = (int)key.ExceptionType; if ((uint)index < (uint)otherExceptions.Length) { WriteBreakOnFirstChance(otherExceptions[index], breakOnFirstChance); } } else { ExceptionInfo info; if (exceptions.TryGetValue(key, out info)) { WriteBreakOnFirstChance(info, breakOnFirstChance); } else { exceptions[key] = info = new ExceptionInfo(key, breakOnFirstChance); if (Changed != null) { Changed(this, new ExceptionManagerEventArgs(ExceptionManagerEventType.Added, info)); } } } }
public void Remove(ExceptionInfoKey key) { ExceptionInfo info; if (!exceptions.TryGetValue(key, out info)) { return; } RemoveExceptions(new ExceptionInfo[] { info }); }
public void Add(ExceptionInfoKey key) { ExceptionInfo info; if (exceptions.TryGetValue(key, out info)) { return; } info = new ExceptionInfo(key, true); exceptions.Add(key, info); Changed?.Invoke(this, new ExceptionServiceEventArgs(ExceptionServiceEventType.Added, info)); }
void LoadInternal() { ILSpySettings settings = ILSpySettings.Load(); var exs = settings[SETTINGS_NAME]; ExceptionManager.Instance.RestoreDefaults(); foreach (var exx in exs.Elements("Exception")) { var exceptionType = (ExceptionType?)(int?)exx.Attribute("ExceptionType"); var fullName = SessionSettings.Unescape((string)exx.Attribute("FullName")); bool?breakOnFirstChance = (bool?)exx.Attribute("BreakOnFirstChance"); bool isOtherExceptions = (bool?)exx.Attribute("IsOtherExceptions") ?? false; var diffType = (ExceptionDiffType?)(int?)exx.Attribute("DiffType"); if (diffType == null) { continue; } if (exceptionType == null || (int)exceptionType.Value < 0 || exceptionType.Value >= ExceptionType.Last) { continue; } if (fullName == null) { continue; } var key = new ExceptionInfoKey(exceptionType.Value, fullName); switch (diffType.Value) { case ExceptionDiffType.Remove: ExceptionManager.Instance.Remove(key); break; case ExceptionDiffType.AddOrUpdate: if (breakOnFirstChance == null) { continue; } ExceptionManager.Instance.AddOrUpdate(key, breakOnFirstChance.Value, isOtherExceptions); break; default: Debug.Fail("Unknown ExceptionDiffType"); break; } } }
public void Add(ExceptionInfoKey key) { ExceptionInfo info; if (exceptions.TryGetValue(key, out info)) { return; } info = new ExceptionInfo(key, true); exceptions.Add(key, info); if (Changed != null) { Changed(this, new ExceptionManagerEventArgs(ExceptionManagerEventType.Added, info)); } }
public void BreakWhenThrown(ExceptionType type, string name) { var key = new ExceptionInfoKey(type, name); if (!exceptionManager.Exists(key)) { exceptionManager.Add(key); } var vm = Collection.FirstOrDefault(a => a.ExceptionInfo.Key.Equals(key)); Debug.Assert(vm != null); if (vm != null) { vm.BreakOnFirstChance = true; } }
void Load() { exceptionManager.RestoreDefaults(); var section = settingsManager.GetOrCreateSection(SETTINGS_GUID); foreach (var exx in section.SectionsWithName("Exception")) { var exceptionType = exx.Attribute <ExceptionType?>("ExceptionType"); var fullName = exx.Attribute <string>("FullName"); bool?breakOnFirstChance = exx.Attribute <bool?>("BreakOnFirstChance"); bool isOtherExceptions = exx.Attribute <bool?>("IsOtherExceptions") ?? false; var diffType = exx.Attribute <ExceptionDiffType?>("DiffType"); if (diffType == null) { continue; } if (exceptionType == null || exceptionType.Value < 0 || exceptionType.Value >= ExceptionType.Last) { continue; } if (fullName == null) { continue; } var key = new ExceptionInfoKey(exceptionType.Value, fullName); switch (diffType.Value) { case ExceptionDiffType.Remove: exceptionManager.Remove(key); break; case ExceptionDiffType.AddOrUpdate: if (breakOnFirstChance == null) { continue; } exceptionManager.AddOrUpdate(key, breakOnFirstChance.Value, isOtherExceptions); break; default: Debug.Fail("Unknown ExceptionDiffType"); break; } } }
void OnException(Exception2DebugCallbackEventArgs e) { if (e.EventType != CorDebugExceptionCallbackType.DEBUG_EXCEPTION_FIRST_CHANCE) { return; } var thread = e.CorThread; if (thread == null) { return; } var exValue = thread.CurrentException; if (exValue == null) { return; } var exType = exValue.ExactType; if (exType == null) { return; } var exTypeName = exType.ToString(TypePrinterFlags.ShowNamespaces); var key = new ExceptionInfoKey(ExceptionType.DotNet, exTypeName); ExceptionInfo info; if (!exceptions.TryGetValue(key, out info)) { info = otherExceptions[(int)ExceptionType.DotNet]; } if (!info.BreakOnFirstChance) { return; } e.AddPauseReason(DebuggerPauseReason.Exception); }
public ExceptionInfo(ExceptionType exceptionType, EXCEPTION_INFO info) { exceptionInfoKey = new ExceptionInfoKey(exceptionType, info.Name); BreakOnFirstChance = (info.State & ExceptionState.EXCEPTION_STOP_FIRST_CHANCE) != 0; IsOtherExceptions = false; }
public ExceptionInfo(ExceptionType exceptionType, string name) { exceptionInfoKey = new ExceptionInfoKey(exceptionType, name); BreakOnFirstChance = false; IsOtherExceptions = true; }
public ExceptionInfo(ExceptionInfoKey key, bool breakOnFirstChance) { exceptionInfoKey = key; BreakOnFirstChance = breakOnFirstChance; IsOtherExceptions = false; }
public ExceptionInfo(ExceptionType exceptionType, string name) { this.exceptionInfoKey = new ExceptionInfoKey(exceptionType, name); this.breakOnFirstChance = false; this.isOtherExceptions = true; }
public ExceptionInfo(ExceptionInfoKey key, bool breakOnFirstChance) { this.exceptionInfoKey = key; this.breakOnFirstChance = breakOnFirstChance; this.isOtherExceptions = false; }
public bool Exists(ExceptionInfoKey key) { return(exceptions.ContainsKey(key)); }
public bool Exists(ExceptionInfoKey key) => exceptions.ContainsKey(key);