Why does WerRegisterAppLocalDump API not work with packaged apps?

Whiskhub 25 Reputation points
2024-08-26T10:56:39.57+00:00

Hello,

I tried to use the WerRegisterAppLocalDump API in a packaged WinUI 3 app.

The function returns HRESULT 0, so success. But if you try to crash the app, no crash dump file is created in any directory of the app data (especially not "relative to the LocalFolder of the packaged application" as documented).

I also tried to use the API in an UWP app for testing, and there at least some dump file is created. But not "relative to the LocalFolder of the packaged application", but rather in the "AC" directory relative to the app data. Additionally, the created dump file is 10x smaller than a regular dump file in %LOCALAPPDATA%\CrashDumps and is almost unusable because it is missing information.

I just need a replacement for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps that works for packaged apps without administrative permissions (see https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps).

Please let me know if this is a bug in Windows and the documentation, or if there is some other way.
Thanks!

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
784 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,609 questions
{count} votes

Accepted answer
  1. Darran Rowe 916 Reputation points
    2024-08-27T01:06:52.6866667+00:00

    After testing this a little, at the very least, the documentation seems to be outright wrong.

    If an application is a packaged desktop application with the equivalent of uap10:TrustLevel set to mediumIL, then the application will follow the regular desktop WER settings.

    If an application is a packaged desktop application with the equivalent of uap10:TrustLevel set to appContainer, then WER will create a subdirectory in the AC directory named what was passed into the function and save the dumps there.

    "Packaged desktop application" does include WinUI 3 applications here, because WinUI 3 runs as a library inside the desktop environment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.