configure_watson.yml (2359B)
1 steps: 2 - powershell: | 3 # Configure Windows Error Reporting (Watson) for crash dump collection 4 # This enables automatic crash dump generation for debugging browser and WebDriver crashes 5 # Only enabled when System.Debug is true to avoid disk space issues in normal runs 6 try { 7 Write-Host "Configuring Windows Error Reporting (Watson) for crash dump collection..." 8 9 # Enable Windows Error Reporting 10 Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name "Disabled" -Value 0 -Type DWord -Force 11 Write-Host "✓ Windows Error Reporting enabled" 12 13 # Configure local dump collection 14 $localDumpsPath = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" 15 if (!(Test-Path $localDumpsPath)) { 16 New-Item -Path $localDumpsPath -Force | Out-Null 17 Write-Host "✓ LocalDumps registry key created" 18 } 19 20 # Set dump folder to artifact staging directory so dumps are automatically published 21 Set-ItemProperty -Path $localDumpsPath -Name "DumpFolder" -Value "$(Build.ArtifactStagingDirectory)" -Type ExpandString -Force 22 Write-Host "✓ Dump folder configured: $(Build.ArtifactStagingDirectory)" 23 24 # Configure dump type (2 = full dump with all memory) 25 Set-ItemProperty -Path $localDumpsPath -Name "DumpType" -Value 2 -Type DWord -Force 26 Write-Host "✓ Dump type set to full dump" 27 28 # Keep up to 10 crash dumps to avoid filling disk space 29 Set-ItemProperty -Path $localDumpsPath -Name "DumpCount" -Value 10 -Type DWord -Force 30 Write-Host "✓ Dump count limit set to 10" 31 32 Write-Host "" 33 Write-Host "Windows Error Reporting configured successfully!" 34 Write-Host "Any browser or WebDriver crashes will generate crash dumps in the artifacts." 35 } 36 catch { 37 Write-Warning "Failed to configure Windows Error Reporting: $($_.Exception.Message)" 38 Write-Warning "Registry access may be restricted on this machine." 39 Write-Host "Continuing without crash dump collection..." 40 } 41 displayName: 'Configure Watson crash reporting (debug mode)' 42 condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['System.Debug'], 'true'))