Skip to content

Commit 39eeff7

Browse files
max-charlambCopilot
andcommitted
Extract unsigned DAC registry logic into shared EnableUnsignedDac.props
Move the DisableAuxProviderSignatureCheck registry key logic into a shared props file imported by both DumpTests.targets and cdac-dump-helix.proj. Add /reg:32 to also set the key in the WoW64 registry view so x86 processes find it under WOW6432Node. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 883fb44 commit 39eeff7

File tree

3 files changed

+39
-18
lines changed

3 files changed

+39
-18
lines changed

src/native/managed/cdac/tests/DumpTests/DumpTests.targets

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,8 @@
6262
<DumpRuntimeVersion Include="$(DumpVersions)" />
6363
</ItemGroup>
6464

65-
<!--
66-
On Windows, heap dumps (type 2) require the DAC (mscordaccore.dll) which is unsigned
67-
in local/CI builds. Set the DisableAuxProviderSignatureCheck registry value so that
68-
MiniDumpWriteDump accepts the unsigned DAC. Windows 11+ / Server 2022+ only.
69-
70-
This is opt-in via /p:SetDisableAuxProviderSignatureCheck=true to avoid surprising
71-
machine-wide registry changes during a normal build.
72-
-->
73-
<Target Name="_EnableUnsignedDacWindows"
74-
BeforeTargets="GenerateAllDumps"
75-
Condition="'$(HostOS)' == 'windows' AND '$(SetDisableAuxProviderSignatureCheck)' == 'true'">
76-
<Exec Command="reg add &quot;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MiniDumpSettings&quot; /v DisableAuxProviderSignatureCheck /t REG_DWORD /d 1 /f"
77-
IgnoreExitCode="true"
78-
IgnoreStandardErrorWarningFormat="true" />
79-
<Message Text="Note: If heap dump generation fails on Windows, ensure the DisableAuxProviderSignatureCheck registry key is set. Run as admin or set manually: reg add &quot;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MiniDumpSettings&quot; /v DisableAuxProviderSignatureCheck /t REG_DWORD /d 1 /f"
80-
Importance="normal" />
81-
</Target>
65+
<!-- Unsigned DAC registry key for heap dumps (shared with cdac-dump-helix.proj) -->
66+
<Import Project="EnableUnsignedDac.props" />
8267

8368
<!-- Filter out Windows-only debuggees on non-Windows platforms. Debuggees opt in
8469
by setting <WindowsOnly>true</WindowsOnly> in their csproj. -->
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project>
2+
3+
<!--
4+
On Windows, heap dumps (type 2) require the DAC (mscordaccore.dll) which is unsigned
5+
in local/CI builds. Set the DisableAuxProviderSignatureCheck registry value so that
6+
MiniDumpWriteDump accepts the unsigned DAC. Windows 11+ / Server 2022+ only.
7+
8+
The key must be set in both the native (64-bit) and WoW64 (32-bit) registry views.
9+
Without /reg:32, x86 processes running under WoW64 read from
10+
HKLM\SOFTWARE\WOW6432Node\... and miss the key, producing degraded dumps.
11+
-->
12+
13+
<PropertyGroup>
14+
<_DacRegKey>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MiniDumpSettings</_DacRegKey>
15+
<_DacRegAdd>reg add &quot;$(_DacRegKey)&quot; /v DisableAuxProviderSignatureCheck /t REG_DWORD /d 1 /f</_DacRegAdd>
16+
<_DacRegAdd32>$(_DacRegAdd) /reg:32</_DacRegAdd32>
17+
</PropertyGroup>
18+
19+
<!--
20+
MSBuild target for local/CI builds (opt-in via /p:SetDisableAuxProviderSignatureCheck=true).
21+
-->
22+
<Target Name="_EnableUnsignedDacWindows"
23+
BeforeTargets="GenerateAllDumps"
24+
Condition="'$(HostOS)' == 'windows' AND '$(SetDisableAuxProviderSignatureCheck)' == 'true'">
25+
<Exec Command="$(_DacRegAdd)" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" />
26+
<!-- WoW64 view only needed for x86 processes -->
27+
<Exec Command="$(_DacRegAdd32)" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true"
28+
Condition="'$(TargetArchitecture)' == 'x86'" />
29+
<Message Text="Note: If heap dump generation fails on Windows, ensure the DisableAuxProviderSignatureCheck registry key is set. Run as admin or set manually: $(_DacRegAdd)"
30+
Importance="normal" />
31+
</Target>
32+
33+
</Project>

src/native/managed/cdac/tests/DumpTests/cdac-dump-helix.proj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
derived from each debuggee's DumpTypes property (Heap->heap/2, Full->full/4).
6464
-->
6565
<Import Project="$(DumpTestsPayload)/debuggee-metadata.props" />
66+
<Import Project="$(MSBuildThisFileDirectory)EnableUnsignedDac.props" />
6667

6768
<!--
6869
Helix work item command: generate dumps then run tests (or tar + upload).
@@ -115,7 +116,9 @@
115116
<!-- Pre-commands: enable dump generation -->
116117
<ItemGroup Condition="'$(TargetOS)' == 'windows'">
117118
<!-- Allow heap dump generation with the unsigned locally-built DAC -->
118-
<HelixPreCommand Include="reg add &quot;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MiniDumpSettings&quot; /v DisableAuxProviderSignatureCheck /t REG_DWORD /d 1 /f 2&gt;nul || (echo DisableAuxProviderSignatureCheck registry write skipped &amp; exit /b 0)" />
119+
<HelixPreCommand Include="$(_DacRegAdd) 2&gt;nul || (echo DisableAuxProviderSignatureCheck registry write skipped &amp; exit /b 0)" />
120+
<!-- WoW64 view only needed for x86 processes -->
121+
<HelixPreCommand Condition="'$(TargetArchitecture)' == 'x86'" Include="$(_DacRegAdd32) 2&gt;nul || (echo DisableAuxProviderSignatureCheck /reg:32 registry write skipped &amp; exit /b 0)" />
119122
<HelixPreCommand Include="set DOTNET_DbgEnableMiniDump=1" />
120123
</ItemGroup>
121124
<ItemGroup Condition="'$(TargetOS)' != 'windows'">

0 commit comments

Comments
 (0)