Skip to content

Commit

Permalink
Update build.yml to test including process dumps
Browse files Browse the repository at this point in the history
Needed to help diagnose issue CommunityToolkit/Windows#347
  • Loading branch information
michael-hawker authored Jul 31, 2024
1 parent a9d1270 commit 67fc76c
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

env:
DOTNET_VERSION: ${{ '8.0.x' }}
ENABLE_DIAGNOSTICS: false
ENABLE_DIAGNOSTICS: true
#COREHOST_TRACE: 1
COREHOST_TRACEFILE: corehosttrace.log

Expand Down Expand Up @@ -153,6 +153,44 @@ jobs:
minimum-size: 32GB
maximum-size: 32GB
disk-root: "C:"

- name: Enable Crash Dumps
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
shell: pwsh
run: |
# If we set the registry from a 32-bit process on a 64-bit machine, we will set the "virtualized" syswow registry.
# For crash dump collection we always want to set the "native" registry, so we make sure to invoke the native cmd.exe
$nativeCmdPath = "$env:SystemRoot\system32\cmd.exe"
if([Environment]::Is64BitOperatingSystem -and ![Environment]::Is64BitProcess)
{
# The "sysnative" path is a 'magic' path that allows a 32-bit process to invoke the native 64-bit cmd.exe.
$nativeCmdPath = "$env:SystemRoot\sysnative\cmd.exe"
}
if(!$dumpFolder)
{
$dumpFolder = "C:\dumps"
}
function Enable-CrashDumpsForProcesses {
Param([string[]]$namesOfProcessesForDumpCollection)
foreach($procName in $namesOfProcessesForDumpCollection )
{
Write-Host "Enabling local crash dumps for $procName"
& $nativeCmdPath /c reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\$procName" /v DumpFolder /t REG_EXPAND_SZ /d $dumpFolder /f
& $nativeCmdPath /c reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\$procName" /v DumpType /t REG_DWORD /d 2 /f
& $nativeCmdPath /c reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\$procName" /v DumpCount /t REG_DWORD /d 3 /f
}
}
# enable dump collection for our test apps:
$namesOfProcessesForDumpCollection = @(
"CommunityToolkit.Tests.Uwp.exe",
"CommunityToolkit.Tests.WinAppSdk.exe",
"VSTest.Console.exe")
Enable-CrashDumpsForProcesses $namesOfProcessesForDumpCollection
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
uses: actions/setup-dotnet@v4
Expand Down Expand Up @@ -235,6 +273,13 @@ jobs:
name: new-experiment-logs
path: ./**/*.*log

- name: Artifact - Process Dumps
uses: actions/upload-artifact@v4
if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }}
with:
name: new-experiment-dumps
path: C:/dumps/*.*dmp

wasm-linux:
runs-on: ubuntu-latest
env:
Expand Down

0 comments on commit 67fc76c

Please sign in to comment.