diff --git a/UnitTests/BugReporter.Tests/SerializableExceptionTests.cs b/UnitTests/BugReporter.Tests/SerializableExceptionTests.cs index 43556bb8b05..a5c18d7125f 100644 --- a/UnitTests/BugReporter.Tests/SerializableExceptionTests.cs +++ b/UnitTests/BugReporter.Tests/SerializableExceptionTests.cs @@ -72,15 +72,16 @@ private static string Sanitize(string exceptionMessage) StringBuilder m = new(); foreach (string line in exceptionMessage.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)) { - Match match = Regex.Match(line, @".*(?\sin\s.*)"); + string sanitizedLine = Regex.Replace(line, "^ --- .* ---$", " --- End of inner exception stack trace ---"); + sanitizedLine = Regex.Replace(sanitizedLine, @"^ \w+ ", " at "); + + Match match = Regex.Match(sanitizedLine, @".*(?\sin\s.*)"); if (match.Success) { - m.AppendLine(line.Replace(match.Groups["path"].Value, string.Empty)); - } - else - { - m.AppendLine(line); + sanitizedLine = sanitizedLine.Replace(match.Groups["path"].Value, string.Empty); } + + m.AppendLine(sanitizedLine); } return m.ToString();