From 80e9b96d434fe274edb298fb80c19c4afa7fec83 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Mon, 26 Aug 2024 15:59:44 -0500 Subject: [PATCH 01/13] Enable crash dumps and diagnostic logs for vstest --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 410265ad..b7278d88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,7 +159,7 @@ jobs: - name: Run component tests against ${{ matrix.multitarget }} if: ${{ matrix.multitarget == 'uwp' || matrix.multitarget == 'wasdk' }} id: test-platform - run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ matrix.multitarget }}.trx" /Blame + run: vstest.console.exe ./tooling/**/CommunityToolkit.Tests.${{ matrix.multitarget }}.build.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=${{ matrix.multitarget }}.trx" /Blame:"CollectDump;DumpType=Full;CollectHangDump;TestTimeout=30m;HangDumpType=Full" /Diag:"${{ github.workspace }}/vstest-diagnostic-log.txt" - name: Create test reports run: | @@ -195,6 +195,13 @@ jobs: name: CrashDumps-${{ matrix.multitarget }}-winui${{ matrix.winui }} path: '${{ github.workspace }}/CrashDumps' + - name: Artifact - vstest-diagnostic-log + uses: actions/upload-artifact@v4 + if: always() + with: + name: 'vstest-diagnostic-log-${{ matrix.multitarget }}-winui${{ matrix.winui }}.txt' + path: '${{ github.workspace }}/vstest-diagnostic-log.txt' + - name: Analyze Dump if: ${{ steps.detect-dump.outputs.DUMP_FILE != '' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} run: | From 6afeb888443e9698137a25be5f816bc2dfd8c1be Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 27 Aug 2024 12:39:32 -0500 Subject: [PATCH 02/13] Enable crash dumps per-process --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7278d88..51929b8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,14 +82,42 @@ jobs: maximum-size: 32GB disk-root: "C:" - - name: Enable User-Mode Dumps collecting - if: ${{ env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '' }} - shell: powershell + - name: Enable Crash Dumps + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + shell: pwsh run: | - New-Item '${{ github.workspace }}\CrashDumps' -Type Directory - Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpFolder' -Type ExpandString -Value '${{ github.workspace }}\CrashDumps' - Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpCount' -Type DWord -Value '10' - Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpType' -Type DWord -Value '2' + # 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.${{ matrix.multitarget }}.exe", + "VSTest.Console.exe") + + Enable-CrashDumpsForProcesses $namesOfProcessesForDumpCollection - name: Install .NET SDK v${{ env.DOTNET_VERSION }} uses: actions/setup-dotnet@v4 @@ -186,14 +214,14 @@ jobs: if: always() working-directory: ${{ github.workspace }} run: | - echo "DUMP_FILE=$(Get-ChildItem .\CrashDumps\*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT + echo "DUMP_FILE=$(Get-ChildItem .C:/dumps/*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT - - name: Artifact - WER crash dumps + - name: Artifact - Process Dumps uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: name: CrashDumps-${{ matrix.multitarget }}-winui${{ matrix.winui }} - path: '${{ github.workspace }}/CrashDumps' + path: C:/dumps/*.*dmp - name: Artifact - vstest-diagnostic-log uses: actions/upload-artifact@v4 From 8606a6a27b401ca1c675f7e878672d8649742fe5 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 27 Aug 2024 13:55:28 -0500 Subject: [PATCH 03/13] Install procdump for crash dumps --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51929b8b..617a5e24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,6 +82,13 @@ jobs: maximum-size: 32GB disk-root: "C:" + - name: Install procdump + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + shell: pwsh + run: | + Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip + Expand-Archive -Path Procdump.zip -DestinationPath $env:ProgramFiles + - name: Enable Crash Dumps if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} shell: pwsh From e3741f7fda634428c5caced0d99ca30685b496c8 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 27 Aug 2024 15:10:40 -0500 Subject: [PATCH 04/13] Set PROCDUMP_PATH environment variable --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 617a5e24..941ed2b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,6 +88,7 @@ jobs: run: | Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip Expand-Archive -Path Procdump.zip -DestinationPath $env:ProgramFiles + $env:PROCDUMP_PATH = $env:ProgramFiles - name: Enable Crash Dumps if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} From 156e1e92bad0b69655ca9dd8d8d0fbef3604a7c3 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 27 Aug 2024 16:42:16 -0500 Subject: [PATCH 05/13] Export PROCDUMP_PATH to github env variables --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 941ed2b8..0456132c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,7 +88,7 @@ jobs: run: | Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip Expand-Archive -Path Procdump.zip -DestinationPath $env:ProgramFiles - $env:PROCDUMP_PATH = $env:ProgramFiles + echo "PROCDUMP_PATH = $env:ProgramFiles" >> $env:GITHUB_ENV - name: Enable Crash Dumps if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} From 7f72c9757407623f0abc8f47c3a6f99fa2f1b8d8 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Tue, 27 Aug 2024 17:20:16 -0500 Subject: [PATCH 06/13] Declared PROCDUMP_PATH as job-level env variable --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0456132c..86755862 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,6 +59,9 @@ jobs: needs: [Xaml-Style-Check] runs-on: windows-latest-large + env: + PROCDUMP_PATH: c:\procdump\ + # See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs strategy: fail-fast: false # prevent one matrix pipeline from being cancelled if one fails, we want them all to run to completion. @@ -87,8 +90,7 @@ jobs: shell: pwsh run: | Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip - Expand-Archive -Path Procdump.zip -DestinationPath $env:ProgramFiles - echo "PROCDUMP_PATH = $env:ProgramFiles" >> $env:GITHUB_ENV + Expand-Archive -Path Procdump.zip -DestinationPath $PROCDUMP_PATH - name: Enable Crash Dumps if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} From 4b3e68dd854e44bd00793e10703e0ef98a829b20 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Wed, 28 Aug 2024 08:36:58 -0500 Subject: [PATCH 07/13] Fix syntax error --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86755862..5f99c7f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,7 +90,7 @@ jobs: shell: pwsh run: | Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip - Expand-Archive -Path Procdump.zip -DestinationPath $PROCDUMP_PATH + Expand-Archive -Path Procdump.zip -DestinationPath ${{ env.PROCDUMP_PATH }} - name: Enable Crash Dumps if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} From b672ac2691d837cdfaaf35b974ce7a9548b9aef7 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Wed, 28 Aug 2024 14:45:08 -0500 Subject: [PATCH 08/13] Use env variable for procdump output --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f99c7f1..7cc525fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,7 +107,7 @@ jobs: if(!$dumpFolder) { - $dumpFolder = "C:\dumps" + $dumpFolder = "${{ env.PROCDUMP_PATH }}" } function Enable-CrashDumpsForProcesses { @@ -224,14 +224,14 @@ jobs: if: always() working-directory: ${{ github.workspace }} run: | - echo "DUMP_FILE=$(Get-ChildItem .C:/dumps/*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT + echo "DUMP_FILE=$(Get-ChildItem ${{ env.PROCDUMP_PATH }}/*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT - name: Artifact - Process Dumps uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: name: CrashDumps-${{ matrix.multitarget }}-winui${{ matrix.winui }} - path: C:/dumps/*.*dmp + path: ${{ env.PROCDUMP_PATH }}/*.dmp - name: Artifact - vstest-diagnostic-log uses: actions/upload-artifact@v4 From 2a2a2d33fbdf5d2f07e260665c010f01f4ff1cef Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Wed, 28 Aug 2024 17:23:28 -0500 Subject: [PATCH 09/13] Fixed syntax error caused by extra forward slash --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7cc525fb..ef7e90ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -224,14 +224,14 @@ jobs: if: always() working-directory: ${{ github.workspace }} run: | - echo "DUMP_FILE=$(Get-ChildItem ${{ env.PROCDUMP_PATH }}/*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT + echo "DUMP_FILE=$(Get-ChildItem ${{ env.PROCDUMP_PATH }}*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT - name: Artifact - Process Dumps uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: name: CrashDumps-${{ matrix.multitarget }}-winui${{ matrix.winui }} - path: ${{ env.PROCDUMP_PATH }}/*.dmp + path: ${{ env.PROCDUMP_PATH }}*.dmp - name: Artifact - vstest-diagnostic-log uses: actions/upload-artifact@v4 From 6fe48519aff8ff6c45b4cae83dba3bd75d2cc8d3 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Fri, 30 Aug 2024 11:47:10 -0500 Subject: [PATCH 10/13] Set procdump path to working directory, fix .dmp artifact upload, cleanup extra script --- .github/workflows/build.yml | 43 +++---------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef7e90ca..bfffd783 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: runs-on: windows-latest-large env: - PROCDUMP_PATH: c:\procdump\ + PROCDUMP_PATH: ${{ github.workspace }} # See https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs strategy: @@ -92,43 +92,6 @@ jobs: Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip Expand-Archive -Path Procdump.zip -DestinationPath ${{ env.PROCDUMP_PATH }} - - 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 = "${{ env.PROCDUMP_PATH }}" - } - - 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.${{ matrix.multitarget }}.exe", - "VSTest.Console.exe") - - Enable-CrashDumpsForProcesses $namesOfProcessesForDumpCollection - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} uses: actions/setup-dotnet@v4 with: @@ -224,14 +187,14 @@ jobs: if: always() working-directory: ${{ github.workspace }} run: | - echo "DUMP_FILE=$(Get-ChildItem ${{ env.PROCDUMP_PATH }}*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT + echo "DUMP_FILE=$(Get-ChildItem ${{ env.PROCDUMP_PATH }}/**/*.dmp -ErrorAction SilentlyContinue)" >> $env:GITHUB_OUTPUT - name: Artifact - Process Dumps uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: name: CrashDumps-${{ matrix.multitarget }}-winui${{ matrix.winui }} - path: ${{ env.PROCDUMP_PATH }}*.dmp + path: ${{ env.PROCDUMP_PATH }}/**/*.dmp - name: Artifact - vstest-diagnostic-log uses: actions/upload-artifact@v4 From 8c870351c8219979edd392a2cefd28063e7834d2 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Fri, 30 Aug 2024 12:13:08 -0500 Subject: [PATCH 11/13] Install procdump after repo checkout --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bfffd783..030be04f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,13 +85,6 @@ jobs: maximum-size: 32GB disk-root: "C:" - - name: Install procdump - if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} - shell: pwsh - run: | - Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip - Expand-Archive -Path Procdump.zip -DestinationPath ${{ env.PROCDUMP_PATH }} - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} uses: actions/setup-dotnet@v4 with: @@ -107,6 +100,13 @@ jobs: with: submodules: recursive + - name: Install procdump + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + shell: pwsh + run: | + Invoke-WebRequest -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile Procdump.zip + Expand-Archive -Path Procdump.zip -DestinationPath ${{ env.PROCDUMP_PATH }} + # Restore Tools from Manifest list in the Repository - name: Restore dotnet tools run: dotnet tool restore From 294457ba071e7dd8bc3e4736ceb4ca8699f6e3d9 Mon Sep 17 00:00:00 2001 From: Arlo Godfrey Date: Fri, 30 Aug 2024 12:35:00 -0500 Subject: [PATCH 12/13] Use unique artifact names for ilc-repro --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 030be04f..7dbdde09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -178,7 +178,7 @@ jobs: uses: actions/upload-artifact@v4 if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} with: - name: ilc-repro + name: ilc-repro-${{ matrix.multitarget }}-winui${{ matrix.winui }} path: ./*.zip # https://github.com/dorny/paths-filter#custom-processing-of-changed-files From 3b386214ba33521b2e0797bc8a32631d5576b7f4 Mon Sep 17 00:00:00 2001 From: Arlo Date: Mon, 16 Dec 2024 11:51:20 -0600 Subject: [PATCH 13/13] Update GitHub Actions runner to use 'windows-latest' instead of 'windows-latest-large' --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c1c0381..33d4092a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,7 +59,7 @@ jobs: # Build both Uno.UI/WinUI2/UWP and Uno.WinUI/WinUI3/WindowsAppSDK versions of our packages using a matrix build: needs: [Xaml-Style-Check] - runs-on: windows-latest-large + runs-on: windows-latest env: PROCDUMP_PATH: ${{ github.workspace }}