Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/BloomExe/NonFatalProblem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public enum PassiveIf
/// </summary>
public class NonFatalProblem
{
// Guard against reentrant calls (e.g. ShowToast → SendBundle → ReportConnectionError → Report)
// which cause infinite mutual recursion leading to a StackOverflowException.
[ThreadStatic]
private static bool s_isReporting;

/// <summary>
/// Always log, possibly inform the user, possibly throw the exception
/// </summary>
Expand Down Expand Up @@ -164,15 +169,24 @@ public static void Report(
if (
!string.IsNullOrEmpty(shortUserLevelMessage)
&& Matches(passive).Any(s => channel.Contains(s))
&& !s_isReporting
)
{
ShowToast(
shortUserLevelMessage,
exception,
fullDetailedMessage,
showSendReport,
showRequestDetails
);
s_isReporting = true;
try
{
ShowToast(
shortUserLevelMessage,
exception,
fullDetailedMessage,
showSendReport,
showRequestDetails
);
}
finally
{
s_isReporting = false;
}
}
}
catch (Exception errorWhileReporting)
Expand Down