Fix recursive call
MODIFY
WalletWasabi.Gui/CommandLine/CrashReportCommand.cs
WalletWasabi.Gui/CommandLine/CrashReportCommand.cs
@@ -32,7 +32,7 @@ namespace WalletWasabi.Gui.CommandLine
{
Options.Parse(args);
- CrashReporter.SetException(ExceptionString, int.Parse(Attempts));
+ CrashReporter.SetShowCrashReport(ExceptionString, int.Parse(Attempts));
}
catch (Exception ex)
{

MODIFY
WalletWasabi.Gui/CrashReport/CrashReporter.cs
WalletWasabi.Gui/CrashReport/CrashReporter.cs
@@ -13,11 +13,11 @@ namespace WalletWasabi.Gui.CrashReport
public class CrashReporter
{
private const int MaxRecursiveCalls = 5;
-
public int Attempts { get; private set; }
public string ExceptionString { get; private set; } = null;
- public bool IsReport => ExceptionString is { };
-
+ public bool IsReport { get; private set; }
+ public bool HadException { get; private set; }
+ public bool IsInvokeRequired => !IsReport && HadException;
public SerializableException SerializedException { get; private set; }
public void InvokeCrashReport()
@@ -39,11 +39,12 @@ namespace WalletWasabi.Gui.CrashReport
return;
}
- public void SetException(string base64ExceptionString, int attempts)
+ public void SetShowCrashReport(string base64ExceptionString, int attempts)
{
Attempts = attempts;
ExceptionString = base64ExceptionString;
SerializedException = SerializableException.FromBase64String(ExceptionString);
+ IsReport = true;
}
/// <summary>
@@ -51,7 +52,9 @@ namespace WalletWasabi.Gui.CrashReport
/// </summary>
public void SetException(Exception ex)
{
- SetException(SerializableException.ToBase64String(ex.ToSerializableException()), 1);
+ SerializedException = ex.ToSerializableException();
+ ExceptionString = SerializableException.ToBase64String(SerializedException);
+ HadException = true;
}
}
}

MODIFY
WalletWasabi.Gui/CrashReport/Views/CrashReportWindow.xaml
WalletWasabi.Gui/CrashReport/Views/CrashReportWindow.xaml
<Button MinWidth="135" Height="35" Command="{Binding OpenLogCommand}">Open logs</Button>
<Button MinWidth="135" Height="35" Background="{DynamicResource ThemeAccentBrush}" Command="{Binding OkCommand}">Ok</Button>
</StackPanel>
- <TextBlock DockPanel.Dock="Top" FontWeight="Bold" FontSize="18" Margin="0,0,0,25" Text="{Binding Message}" />
+ <TextBox DockPanel.Dock="Top" Text="{Binding Message}" IsReadOnly="True" TextWrapping="Wrap" AcceptsReturn="True" FontWeight="Bold" FontSize="18" Margin="0,0,0,25" BorderThickness="0" />
<TextBox Text="{Binding Details}" IsReadOnly="True" Margin="0 8" TextWrapping="Wrap" AcceptsReturn="True" BorderThickness="0" />
</DockPanel>
</cont:MetroWindow>

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -130,7 +130,7 @@ namespace WalletWasabi.Gui
MainWindowViewModel.Instance.Dispose();
}
- if (Global?.CrashReporter?.IsReport is true)
+ if (Global?.CrashReporter?.IsInvokeRequired is true)
{
// Trigger the CrashReport process.
Global.CrashReporter.InvokeCrashReport();

Fix recursive call