Revert "DataGridView filtering internal NullReferenceException **HACK**"

This reverts commit e1f749c3da7c9bc3de8dc0a9eb9d482b92476df9.
This commit is contained in:
Michael Bucari-Tovo 2025-02-10 10:19:24 -07:00
parent e1f749c3da
commit 8ec7e5a9d2

View File

@ -12,34 +12,17 @@ namespace LibationWinForms
{ {
public static class MessageBoxLib public static class MessageBoxLib
{ {
private static int nreCount = 0; /// <summary>
private const int NRE_LIMIT = 5; /// Logs error. Displays a message box dialog with specified text and caption.
/// </summary>
/// <summary> /// <param name="synchronizeInvoke">Form calling this method.</param>
/// Logs error. Displays a message box dialog with specified text and caption. /// <param name="text">The text to display in the message box.</param>
/// </summary> /// <param name="caption">The text to display in the title bar of the message box.</param>
/// <param name="synchronizeInvoke">Form calling this method.</param> /// <param name="exception">Exception to log.</param>
/// <param name="text">The text to display in the message box.</param> public static void ShowAdminAlert(System.ComponentModel.ISynchronizeInvoke owner, string text, string caption, Exception exception)
/// <param name="caption">The text to display in the title bar of the message box.</param>
/// <param name="exception">Exception to log.</param>
public static void ShowAdminAlert(System.ComponentModel.ISynchronizeInvoke owner, string text, string caption, Exception exception)
{ {
// HACK: limited NRE swallowing -- this. is. AWFUL // for development and debugging, show me what broke!
// I can't figure out how to circumvent the DataGridView internal NRE when: if (System.Diagnostics.Debugger.IsAttached)
// * book has tag: asdf
// * filter is `[asdf]`
// * tag asdf is removed from book
// * DataGridView throws NRE
if (exception is NullReferenceException nre && nreCount < NRE_LIMIT)
{
nreCount++;
Serilog.Log.Logger.Error(nre, "Alert admin error. Swallow NRE: {@DebugText}", new { text, caption, nreCount });
return;
}
// for development and debugging, show me what broke!
if (System.Diagnostics.Debugger.IsAttached)
throw exception; throw exception;
try try