diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e19ef14b..2d4d0ed8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: env: DOTNET_VERSION: ${{ '8.0.x' }} - ENABLE_DIAGNOSTICS: false + ENABLE_DIAGNOSTICS: true #COREHOST_TRACE: 1 COREHOST_TRACEFILE: corehosttrace.log @@ -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 @@ -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: