add functionality
MODIFY
WalletWasabi.Gui/CommandLine/CrashReportCommand.cs
WalletWasabi.Gui/CommandLine/CrashReportCommand.cs
@@ -25,7 +25,6 @@ namespace WalletWasabi.Gui.CommandLine
private void ExceptionDecode(string exceptionString)
{
var e = Guard.NotNullOrEmptyOrWhitespace(nameof(exceptionString), exceptionString);
- e = e.Trim(' ').Trim('\"');
Global.CrashReportException = JsonConvert.DeserializeObject<SerializedException>(e);
}

MODIFY
WalletWasabi.Gui/CrashReporter/Models/SerializedException.cs
WalletWasabi.Gui/CrashReporter/Models/SerializedException.cs
using System;
+using System.Collections.Generic;
+using WalletWasabi.Helpers;
namespace WalletWasabi.Gui.CrashReporter.Models
{
[Serializable]
public class SerializedException
{
- public Type ExceptionType { get; set; }
+ public string ExceptionType { get; set; }
public string Message { get; set; }
public string StackTrace { get; set; }
public SerializedException InnerException { get; set; }
@@ -16,13 +18,82 @@ namespace WalletWasabi.Gui.CrashReporter.Models
public SerializedException(Exception ex)
{
- if (ex.InnerException is object)
+ if (ex.InnerException != null)
{
InnerException = new SerializedException(ex.InnerException);
}
- ExceptionType = ex.GetType();
+ ExceptionType = ex.GetType().FullName;
Message = ex.Message;
StackTrace = ex.StackTrace;
}
+
+ public override string ToString()
+ {
+ return ToStringCore();
+ }
+
+ internal string ToStringCore(int tabLevel = 0)
+ {
+ var sb = new System.Text.StringBuilder();
+
+ if (!string.IsNullOrEmpty(ExceptionType))
+ {
+ sb.Append(Tabs(tabLevel));
+ sb.Append("ExceptionType: ");
+ sb.AppendLine(ExceptionType);
+ }
+
+ if (!string.IsNullOrEmpty(Message))
+ {
+ sb.Append(Tabs(tabLevel));
+ sb.Append("Message: ");
+ sb.AppendLine(Message);
+ }
+
+ if (!string.IsNullOrEmpty(StackTrace))
+ {
+ sb.Append(Tabs(tabLevel));
+ sb.Append("StackTrace: ");
+ sb.Append(Tabs(tabLevel));
+ sb.AppendLine(MultiLineTabs(tabLevel, StackTrace));
+ }
+
+ if (InnerException != null)
+ {
+ var header = "InnerException: ";
+ sb.Append(Tabs(tabLevel));
+ sb.Append(header);
+ sb.Append(Tabs(tabLevel+1));
+ sb.AppendLine(MultiLineTabs(tabLevel + 1, InnerException.ToString(), header.Length));
+ }
+
+ return sb.ToString();
+ }
+
+ internal string MultiLineTabs(int n, string t, int addedPadding = 0)
+ {
+ int i = 0;
+ var sb = new System.Text.StringBuilder();
+ foreach (var line in t.Split(Environment.NewLine))
+ {
+ switch (i)
+ {
+ case 0:
+ sb.AppendLine(line);
+ break;
+ default:
+ var padding = new string(' ', addedPadding);
+ sb.AppendLine($"{padding}{Tabs(n)}{line}");
+ break;
+ }
+ i++;
+ }
+ return sb.ToString();
+ }
+
+ internal string Tabs(int n)
+ {
+ return n == 0 ? string.Empty : new string(' ', n * 4);
+ }
}
}

MODIFY
WalletWasabi.Gui/CrashReporter/ViewModels/CrashReportWindowViewModel.cs
WalletWasabi.Gui/CrashReporter/ViewModels/CrashReportWindowViewModel.cs
@@ -9,9 +9,10 @@ namespace WalletWasabi.Gui.CrashReporter.ViewModels
{
Global = Locator.Current.GetService<Global>();
}
-
+ public int WinWidth => 640;
+ public int WinHeight => 360;
public string Title => "Wasabi Wallet - Crash Reporting";
- public SerializedException ReportedException => Global.CrashReportException;
+ public string ReportedException => Global.CrashReportException.ToString();
public Global Global { get; }
}

MODIFY
WalletWasabi.Gui/CrashReporter/Views/CrashReportWindow.xaml
WalletWasabi.Gui/CrashReporter/Views/CrashReportWindow.xaml
x:Class="WalletWasabi.Gui.CrashReporter.Views.CrashReportWindow"
Icon="avares://WalletWasabi.Gui/Assets/WasabiLogo256.png"
Title="{Binding Title}"
- MinWidth="400" MinHeight="400"
+ Width="{Binding WinWidth}" Height="{Binding WinHeight}"
+ MinWidth="{Binding WinWidth}" MinHeight="{Binding WinHeight}"
+ MaxWidth="{Binding WinWidth}" MaxHeight="{Binding WinHeight}"
FontFamily="{DynamicResource UiFont}" FontSize="14"
Foreground="{DynamicResource ThemeForegroundBrush}"
WindowState="{Binding WindowState}">
- <Grid>
-
+ <Grid ColumnDefinitions="*,*" RowDefinitions="*,Auto">
+ <TextBox Grid.ColumnSpan="2" Grid.RowSpan="1" Classes="monospaceFont" AcceptsReturn="True" Text="{Binding ReportedException}"/>
</Grid>
</cont:MetroWindow>

add functionality