Skip to content

Commit 286c636

Browse files
collect crash dump, upload dump and pdb to artifact (#4666)
* collect crash dump, upload dump and pdb to artifact * only set registry to take crash dump on CI
1 parent 1658ce2 commit 286c636

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

build/ci/job-template.yml

+9
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ jobs:
9595
**/TestOutput/**/*
9696
**/*.trx
9797
targetFolder: $(Build.ArtifactStagingDirectory)
98+
- task: CopyFiles@2
99+
displayName: Stage process dump and pdb if any
100+
condition: not(succeeded())
101+
inputs:
102+
sourceFolder: $(Build.SourcesDirectory)
103+
contents: |
104+
CrashDumps/*.dmp
105+
bin/**/*.pdb
106+
targetFolder: $(Build.ArtifactStagingDirectory)
98107
- task: PublishBuildArtifacts@1
99108
displayName: Publish build and test logs
100109
condition: not(succeeded())

init-tools.cmd

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ if exist "%DOTNET_CMD%" goto :afterdotnetrestore
5959

6060
if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%"
6161

62+
:: set registry to take dump automatically when test process crashes
63+
if NOT [%AGENT_ID%] == [] (
64+
reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps"
65+
reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps" /v DumpType /t REG_DWORD /d 2
66+
reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps" /v DumpCount /t REG_DWORD /d 2
67+
reg add "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\LocalDumps" /v DumpFolder /t REG_SZ /d "%~dp0CrashDumps"
68+
)
69+
6270
:: install the extra runtime first, so the SDK install will overwrite the root dotnet executable
6371
echo Installing dotnet runtime %DOTNET_EXTRA_RUNTIME_VERSION%...
6472
set DOTNET_EXTRA_RUNTIME_ZIP_NAME=dotnet-runtime-%DOTNET_EXTRA_RUNTIME_VERSION%-win-%ARCH%.zip

0 commit comments

Comments
 (0)