Skip to content

[cDAC] Dumptest Stackwalker Improvements#124912

Draft
max-charlamb wants to merge 2 commits intodotnet:mainfrom
max-charlamb:cdac-dumptest-improvements
Draft

[cDAC] Dumptest Stackwalker Improvements#124912
max-charlamb wants to merge 2 commits intodotnet:mainfrom
max-charlamb:cdac-dumptest-improvements

Conversation

@max-charlamb
Copy link
Member

Adds tools to better add stack tests

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new DumpTestStackWalker helper class to simplify writing stack frame validation tests in the cDAC dump test suite, and adds three new tests demonstrating its usage.

Changes:

  • Adds DumpTestStackWalker helper class with fluent API for asserting stack frame sequences with support for adjacency checking, predicate matching, and flexible inner-to-outer/outer-to-inner traversal
  • Adds new tests validating expected frame sequences in StackWalk, PInvokeStub, and VarargPInvoke dump tests
  • Updates RunDumpTests.ps1 to compute and pass skip versions to the test build, improving test filtering when running subset of versions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
DumpTestStackWalker.cs New helper class providing fluent API for stack frame assertions with support for adjacency, predicates, and directional traversal
StackWalkDumpTests.cs Adds test validating the expected frame sequence (MethodC → MethodB → MethodA → Main) using the new helper
VarargPInvokeDumpTests.cs Adds test validating vararg P/Invoke stack frames including ILStub frame detection using predicate matching
PInvokeStubDumpTests.cs Adds test validating P/Invoke stack frames (memcpy → CrashInILStubPInvoke → Main)
RunDumpTests.ps1 Enhances script to compute and pass skipped versions to test build via MSBuild property

Comment on lines +270 to +284
public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = name;
_predicate = null;
_assert = assert;
this.Adjacent = Adjacent;
Description = name;
}

public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = null;
_predicate = predicate;
_assert = assert;
this.Adjacent = Adjacent;
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name Adjacent should be lowercase adjacent to follow C# naming conventions. Parameter names should use camelCase, not PascalCase.

Suggested change
public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = name;
_predicate = null;
_assert = assert;
this.Adjacent = Adjacent;
Description = name;
}
public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = null;
_predicate = predicate;
_assert = assert;
this.Adjacent = Adjacent;
public Expectation(string name, bool adjacent, Action<ResolvedFrame>? assert)
{
_name = name;
_predicate = null;
_assert = assert;
this.Adjacent = adjacent;
Description = name;
}
public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool adjacent, Action<ResolvedFrame>? assert)
{
_name = null;
_predicate = predicate;
_assert = assert;
this.Adjacent = adjacent;

Copilot uses AI. Check for mistakes.
Comment on lines +270 to +284
public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = name;
_predicate = null;
_assert = assert;
this.Adjacent = Adjacent;
Description = name;
}

public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = null;
_predicate = predicate;
_assert = assert;
this.Adjacent = Adjacent;
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name Adjacent should be lowercase adjacent to follow C# naming conventions. Parameter names should use camelCase, not PascalCase.

Suggested change
public Expectation(string name, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = name;
_predicate = null;
_assert = assert;
this.Adjacent = Adjacent;
Description = name;
}
public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool Adjacent, Action<ResolvedFrame>? assert)
{
_name = null;
_predicate = predicate;
_assert = assert;
this.Adjacent = Adjacent;
public Expectation(string name, bool adjacent, Action<ResolvedFrame>? assert)
{
_name = name;
_predicate = null;
_assert = assert;
this.Adjacent = adjacent;
Description = name;
}
public Expectation(Func<ResolvedFrame, bool> predicate, string description, bool adjacent, Action<ResolvedFrame>? assert)
{
_name = null;
_predicate = predicate;
_assert = assert;
this.Adjacent = adjacent;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants