3

I'm trying to create crash dump files for a crashing IIS/.NET process on Windows Server 2012 R2.

I've written the following PowerShell script as part of code deployment which works correctly for local development, but with the same Registry keys set on the application server, dump files are not created. I've checked the permissions for SYSTEM on the registry and the collection folder and they seem to be correct, so I'm not quite sure why the dump files aren't being generated.

Running a test application on the server that does nothing but crash via a stack overflow just generates an application pop-up, but no dump files.

I tried all of the possible solutions given here, and none of them have resolved the problem.

A new guard page for the stack cannot be created

$dumpFolder = "C:\crash-dumps"

if (!(Test-Path $dumpFolder)) {
    mkdir $dumpFolder | Out-Null
}

$dumpKey = "HKLM:SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps"

if (!(Test-Path $dumpKey)) {
    New-Item -Path $dumpKey | Out-Null
}

$dumpKey = "HKLM:SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\dotnet.exe"
New-Item -Path $dumpKey -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpFolder -Value $dumpFolder -PropertyType String -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpCount -Value 3 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpType -Value 2 -PropertyType DWORD -Force | Out-Null

$dumpKey = "HKLM:SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\w3wp.exe"

New-Item -Path $dumpKey -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpFolder -Value $dumpFolder -PropertyType String -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpCount -Value 3 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $dumpKey -Name DumpType -Value 2 -PropertyType DWORD -Force | Out-Null
Martin Costello
  • 9,672
  • 5
  • 60
  • 72
  • The [MS documentation](https://learn.microsoft.com/en-us/windows/desktop/wer/collecting-user-mode-dumps) states that `DumpFolder` should be a 'REG_EXPAND_SZ' type, which is passed as 'ExpandString' when using `New-ItemProperty`. You pass it as 'String'. Not sure if it will help, but it's worth a try. – boxdog Jan 11 '19 at 14:01
  • But on my laptop it is not `REG_EXPAND_SZ`, and it still works. Also, the path is hard-coded and doesn't contain any environment variables that need expanding. It also tried changing the type, and it still didn't work. – Martin Costello Jan 11 '19 at 14:07
  • Yeah, thought it was a long shot. – boxdog Jan 11 '19 at 14:17
  • Does the process have sufficient privileges to write to that folder? – Arca Artem Jan 16 '19 at 16:41
  • I believe so, as the System account had write access. Dumps don't get created with the Windows default if I don't use a custom folder either though. – Martin Costello Jan 17 '19 at 10:07
  • 1
    Try setting DontShowUI to 1, we had troubles capturing dumps without it: https://github.com/aspnet/AspNetCore/blob/master/src/Servers/IIS/tools/SetupTestEnvironment.ps1#L80 – Pavel Krymets Jan 26 '19 at 05:12
  • @PavelKrymets Thanks, I'll give that a try. I also notice that you're restarting WER too. – Martin Costello Jan 26 '19 at 09:23
  • I've tried this on a vanilla AWS EC2 instance with Server 2012 R2, and the default WER pops up, which generates the dump when interacted with. Disabling the UI just generates the dump with no pop-up. I wonder whether in my case there's something else installed overriding the default WER handler/UI, which is stopping WER from getting a chance to intercept the crash in the first place. – Martin Costello Jan 27 '19 at 12:17
  • So `DontShowUI` doesn't fix that UI pop-up, so it must be being generated by something other than WER. It's likely once I solve whatever that is, I'll probably need it anyway. – Martin Costello Jan 28 '19 at 10:42
  • This seems to be some strange artifact of _something_ custom on our Windows 2012 R2 AWS AMIs. – Martin Costello Jan 31 '19 at 10:56
  • Possible duplicate of [Windows does not produce full crash dumps even though registry is set correctly](https://stackoverflow.com/questions/30457570/windows-does-not-produce-full-crash-dumps-even-though-registry-is-set-correctly) – Thomas Weller Apr 07 '19 at 18:13
  • 1
    @ThomasWeller None of the suggestions in the other question resolved the issue before this question was posted. Have edited to state that explicitly. – Martin Costello Apr 08 '19 at 09:08
  • @MartinCostello: I have added two options since then. Did you check "User settings instead of machine settings"? – Thomas Weller Apr 08 '19 at 09:22
  • Yes, I checked that too. – Martin Costello Apr 08 '19 at 09:36
  • @MartinCostello , were you able to solve this issue? – AntonK Sep 28 '21 at 16:10
  • @AntonK I'm afraid not. We've upgraded from 2012 R2 now, and don't need to solve it anymore either. – Martin Costello Sep 28 '21 at 18:33

0 Answers0