Skip to content
Merged
Show file tree
Hide file tree
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: 28 additions & 0 deletions src/Verify.Tests/ScrubStackTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,34 @@ at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& complete
return Verify(scrubbed);
}

// NativeAOT renders unresolved frames with no parameter list
[Fact]
public Task NoParens()
{
var scrubbed = ScrubStackTrace.Scrub(
"""
System.Exception: Boom
at MyApp!<BaseAddress>+0x1a2b3c
at MyApp.Program.Main(String[] args) in /src/Program.cs:line 12
at MyApp!<BaseAddress>+0x4d5e6f
""");
return Verify(scrubbed);
}

[Fact]
public Task NoParens_RemoveParams()
{
var scrubbed = ScrubStackTrace.Scrub(
"""
System.Exception: Boom
at MyApp!<BaseAddress>+0x1a2b3c
at MyApp.Program.Main(String[] args) in /src/Program.cs:line 12
at MyApp!<BaseAddress>+0x4d5e6f
""",
removeParams: true);
return Verify(scrubbed);
}

[Fact]
public Task WhiteSpace()
{
Expand Down
4 changes: 4 additions & 0 deletions src/Verify.Tests/ScrubStackTraceTests.NoParens.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
System.Exception: Boom
at MyApp!<BaseAddress>+0x1a2b3c
at MyApp.Program.Main(String[] args)
at MyApp!<BaseAddress>+0x4d5e6f
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
System.Exception: Boom
at MyApp!<BaseAddress>+0x1a2b3c
at MyApp.Program.Main(...)
at MyApp!<BaseAddress>+0x4d5e6f
10 changes: 10 additions & 0 deletions src/Verify/Serialization/Scrubbers/ScrubStackTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ public static string Scrub(string stackTrace, bool removeParams = false)
var indexOfLeft = span.IndexOf('(');

var indexOfRight = span.IndexOf(')');

// Not every frame has a parameter list. NativeAOT renders unresolved frames
// as `at MyApp!<BaseAddress>+0x1a2b3c`, which has nothing to trim.
if (indexOfLeft == -1 ||
indexOfRight == -1)
{
builder.AppendLineN(span);
continue;
}

if (removeParams)
{
var next = indexOfLeft + 1;
Expand Down
2 changes: 1 addition & 1 deletion src/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ All six resolved 2026-08-16 (five fixed here; the inline item resolved as by-des

## Minor / edge cases

- [ ] **Stack-trace scrubber destroys paren-less `at` frames** (NativeAOT: `at MyApp!<BaseAddress>+0x1a2b3c`).
- [x] **Stack-trace scrubber destroys paren-less `at` frames** (NativeAOT: `at MyApp!<BaseAddress>+0x1a2b3c`).
`Verify/Serialization/Scrubbers/ScrubStackTrace.cs:36-58` — `IndexOf('(')`/`')'` return −1, slice keeps zero chars → frame becomes an empty line, or the literal `...)` with `removeParams: true`.

- [ ] **MSTest source generator ignores `record` test classes.**
Expand Down
Loading