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
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ public override void Evaluate(EvaluationContext ctx, TextWriter output)
if (ctx.LogEvent.Exception is null)
return;

var lines = new StringReader(ctx.LogEvent.Exception.ToString());
StringReader lines;
try
{
lines = new StringReader(ctx.LogEvent.Exception.ToString());
}
catch (Exception e)
{
lines = new StringReader(
$"[Exception.ToString() failed: {e.Message}] Original exception type: {ctx.LogEvent.Exception?.GetType().FullName}, message: {ctx.LogEvent.Exception?.Message}{Environment.NewLine}");
}

while (lines.ReadLine() is { } nextLine)
{
var style = nextLine.StartsWith(StackFrameLinePrefix) ? _secondaryText : _text;
Expand Down