Skip to content

Comments

Add AVRepro console app for reproducing arm64 AccessViolationException#104

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-avrepro-console-app
Draft

Add AVRepro console app for reproducing arm64 AccessViolationException#104
Copilot wants to merge 4 commits intomainfrom
copilot/add-avrepro-console-app

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

Adds a test harness to reproduce AccessViolationException bugs (dotnet/runtime#123324, dotnet/runtime#112167) on arm64 macOS by spawning parallel processes using both standard and experimental APIs.

Changes

  • AVRepro console app: Targets net10.0 with single-file publishing and compression enabled
    • No args: Spawns 8 parallel /bin/echo processes via Process.Start
    • With args: Same workload using ChildProcess.ExecuteAsync API
  • CI extension: macOS leg now publishes for osx-arm64 and executes both modes 10 times in a loop to increase reproduction rate
// Example: stress test with new API
var tasks = Enumerable.Range(0, 8)
    .Select(i => Task.Run(async () =>
    {
        ProcessStartOptions options = new("/bin/echo")
        {
            Arguments = { "hello!" }
        };
        await ChildProcess.ExecuteAsync(options);
    }));
await Task.WhenAll(tasks);

The CI workflow runs both execution modes (with and without new API) 10 times sequentially to maximize the chances of reproducing the AccessViolationException issue.

Original prompt

This section details on the original issue you should resolve

<issue_title>Try to reproduce AccessViolationException on arm64</issue_title>
<issue_description>.NET runtime users are hunted by these two bugs: dotnet/runtime#123324 and dotnet/runtime#112167.

Let's do the following:

  • Add new C# console app to the solution. Let's name it "AVRepro"
  • Use following MSBuild settings:
    <PropertyGroup>
      <OutputType>Exe</OutputType>
      <TargetFramework>net10.0</TargetFramework>
      <SelfContained>true</SelfContained>
      <PublishSingleFile>true</PublishSingleFile>
      <EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
    </PropertyGroup>
  • Add reference to Library.csproj project file
  • Add a logic that runs the following code if no args were specified:
  using System.Diagnostics;

  var tasks = Enumerable.Range(0, 2)
      .Select(i => Task.Run(async () =>
      {
          var psi = new ProcessStartInfo
          {
              FileName = "/bin/echo",
              Arguments = "hello!",
          };
          using var process = Process.Start(psi)!;
          await process.WaitForExitAsync();
      }));

  await Task.WhenAll(tasks);
  • Add a logic that uses the new API (ChildProcess.ExecuteAsync) to do the same when args were specified.

  • Extend the macOS CI leg with logic that achieves the following:

  dotnet publish -c Release -r osx-arm64
  ./bin/Release/net10.0/osx-arm64/publish/AVRepro --useNewAPI
  ./bin/Release/net10.0/osx-arm64/publish/AVRepro

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new C# console app to reproduce AccessViolationException Add AVRepro console app for reproducing arm64 AccessViolationException Jan 19, 2026
Copilot AI requested a review from adamsitnik January 19, 2026 11:10
Copy link
Owner

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

@copilot You did exactly what I asked for, great! Since the problem does not reproduce, we need to do it more than once. Please address my comment.

Comment on lines 47 to 52
- name: Run AVRepro with new API (osx-arm64) - macOS Only
if: runner.os == 'macOS'
run: ./AVRepro/bin/Release/net10.0/osx-arm64/publish/AVRepro --useNewAPI
- name: Run AVRepro with Process.Start (osx-arm64) - macOS Only
if: runner.os == 'macOS'
run: ./AVRepro/bin/Release/net10.0/osx-arm64/publish/AVRepro
Copy link
Owner

Choose a reason for hiding this comment

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

let's introduce a loop and run the last two steps ten times

Copy link
Owner

Choose a reason for hiding this comment

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

@copilot please try one more time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a loop to run both AVRepro executions 10 times in commit d52d32c.

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Try to reproduce AccessViolationException on arm64

2 participants