Skip to content

Copy createdump alongside NativeAOT test binaries for crash dumps#127588

Open
agocke wants to merge 1 commit intodotnet:mainfrom
agocke:copilot/createdump-nativeaot
Open

Copy createdump alongside NativeAOT test binaries for crash dumps#127588
agocke wants to merge 1 commit intodotnet:mainfrom
agocke:copilot/createdump-nativeaot

Conversation

@agocke
Copy link
Copy Markdown
Member

@agocke agocke commented Apr 29, 2026

Note

This PR was generated with the help of GitHub Copilot.

NativeAOT tests set DOTNET_DbgEnableMiniDump=1 via RunnerTemplate.sh but createdump was not being deployed next to the test binary, so crash dumps could not be collected on Helix. Regular CoreCLR tests get createdump via the testhost shared framework, but NativeAOT tests are self-contained and don't have a testhost.

This adds an MSBuild target that copies createdump from CoreCLR artifacts into the NativeAOT test publish directory after Publish, so it's included in the test archive sent to Helix.

NativeAOT tests set DOTNET_DbgEnableMiniDump=1 via RunnerTemplate.sh
but createdump was not being deployed next to the test binary, so crash
dumps could not be collected on Helix. Regular CoreCLR tests get
createdump via the testhost shared framework, but NativeAOT tests are
self-contained and don't have a testhost.

Copy createdump from CoreCLR artifacts into the NativeAOT test publish
directory after Publish, so it's included in the test archive sent to
Helix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 22:43
Copy link
Copy Markdown
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 updates the NativeAOT test publishing flow to include the createdump tool in the published output so that DOTNET_DbgEnableMiniDump=1 can successfully generate crash dumps on Helix for self-contained NativeAOT test apps.

Changes:

  • Adds an MSBuild target that runs after Publish for TestNativeAot builds (non-Windows) to copy createdump into the NativeAOT test publish directory.
  • Uses an OS-specific source path for createdump on macOS vs. other Unix platforms.

Comment on lines +66 to +74
<!-- Copy createdump next to the published NativeAOT test binary so crash dumps can be collected on Helix. -->
<Target Name="CopyCreatedumpForNativeAot"
Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'"
AfterTargets="Publish">
<PropertyGroup>
<_CreatedumpSource Condition="'$(TargetOS)' == 'osx'">$(CoreCLRArtifactsPath)sharedFramework/createdump</_CreatedumpSource>
<_CreatedumpSource Condition="'$(TargetOS)' != 'osx'">$(CoreCLRArtifactsPath)createdump</_CreatedumpSource>
</PropertyGroup>
<Copy SourceFiles="$(_CreatedumpSource)"
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

Copying only the createdump executable is likely insufficient: createdump unconditionally dlopen()s the DAC (mscordaccore / libmscordaccore.*) from the same directory as the createdump binary (see src/coreclr/debug/createdump/createdumppal.cpp). If the DAC isn't also present next to createdump in $(BundleDir), dump generation will fail with a dlopen error, so Helix still won't get dumps. Consider copying the matching mscordaccore binary from the same CoreCLR artifacts location alongside createdump (and any other required adjacent dependencies, if applicable).

Suggested change
<!-- Copy createdump next to the published NativeAOT test binary so crash dumps can be collected on Helix. -->
<Target Name="CopyCreatedumpForNativeAot"
Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'"
AfterTargets="Publish">
<PropertyGroup>
<_CreatedumpSource Condition="'$(TargetOS)' == 'osx'">$(CoreCLRArtifactsPath)sharedFramework/createdump</_CreatedumpSource>
<_CreatedumpSource Condition="'$(TargetOS)' != 'osx'">$(CoreCLRArtifactsPath)createdump</_CreatedumpSource>
</PropertyGroup>
<Copy SourceFiles="$(_CreatedumpSource)"
<!-- Copy createdump and its colocated DAC next to the published NativeAOT test binary so crash dumps can be collected on Helix. -->
<Target Name="CopyCreatedumpForNativeAot"
Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'"
AfterTargets="Publish">
<PropertyGroup>
<_CreatedumpSourceDir Condition="'$(TargetOS)' == 'osx'">$(CoreCLRArtifactsPath)sharedFramework/</_CreatedumpSourceDir>
<_CreatedumpSourceDir Condition="'$(TargetOS)' != 'osx'">$(CoreCLRArtifactsPath)</_CreatedumpSourceDir>
<_CreatedumpSource>$(_CreatedumpSourceDir)createdump</_CreatedumpSource>
</PropertyGroup>
<ItemGroup>
<_CreatedumpArtifacts Include="$(_CreatedumpSource)" Condition="Exists('$(_CreatedumpSource)')" />
<_CreatedumpArtifacts Include="$(_CreatedumpSourceDir)libmscordaccore.*" />
</ItemGroup>
<Copy SourceFiles="@(_CreatedumpArtifacts)"

Copilot uses AI. Check for mistakes.
@MichalStrehovsky
Copy link
Copy Markdown
Member

so crash dumps could not be collected on Helix

We get the native dumps though.

If dumps with createdump have everything native dumps would have, this works for me. I've never (knowingly) debugged a dump obtained with createdump.

</PropertyGroup>
<Copy SourceFiles="$(_CreatedumpSource)"
DestinationFolder="$(BundleDir)"
Condition="Exists('$(_CreatedumpSource)')"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes all of this a NOP because we don't build createdump in any native AOT test legs.


<!-- Copy createdump next to the published NativeAOT test binary so crash dumps can be collected on Helix. -->
<Target Name="CopyCreatedumpForNativeAot"
Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why non-Windows only?

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.

3 participants