Skip to content

Fix: Deployment exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars#6323

Merged
agniuks merged 3 commits into
mainfrom
user/agnel/telemetry
Mar 23, 2026
Merged

Fix: Deployment exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars#6323
agniuks merged 3 commits into
mainfrom
user/agnel/telemetry

Conversation

@agniuks

@agniuks agniuks commented Mar 21, 2026

Copy link
Copy Markdown
Collaborator

What changed & why

add wil/cppwinrt.h to DeploymentManagerAutoInitializer.cpp:

97% of DeploymentManager Initialize failures (60,139 of ~62K) report as ERROR_UNHANDLED_EXCEPTION with no actionable signal. Root cause: the activation entry point was missing wil/cppwinrt.h, so WIL's exception translator was never registered and all real errors (E_ACCESSDENIED, package downgrade, etc.) collapsed to a single meaningless code. After this fix those errors will surface with their real HRESULTs, making our initialization failure rate actually debuggable.

Expand catch block in DeploymentManager.cpp

Initialize() only caught winrt::hresult_error, silently bypassing event log, debugger break, and error UI for all other exception types. Replaced with a single catch(...) using wil::ResultFromCaughtException().

Fix dereference bug in SetLastFailure (3 files)

*failure.pszFile dereferences a PCSTR to its first char, confirmed through installer telemetry - we should get the full filename after this change.

Complements #6319 which fixes telemetry activity starting too late to capture early failures.

@agniuks
agniuks requested review from DrusTheAxe, lauren-ciha and ssparach and removed request for DrusTheAxe March 21, 2026 03:11
@agniuks agniuks changed the title Fix: Deployment/Installer exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars Fix: Deployment exceptions masked as ERROR_UNHANDLED_EXCEPTION; SetLastFailure logging single chars Mar 21, 2026

@DrusTheAxe DrusTheAxe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo one additional change

#include <wil/cppwinrt.h> appears in dev\WindowsAppRuntime_DLL\pch.h but the auto-initializers don't #include that. You should add it to the others like you did DeploymentManagerAutoInitializer.cpp to ensure the right behavior, now and into the future

dir /s/b dev\*autoinitializ*.cpp yields 4 files

  1. dev\Common\WindowsAppRuntimeAutoInitializer.cpp
  2. dev\Deployment\DeploymentManagerAutoInitializer.cpp
  3. dev\UndockedRegFreeWinRT\UndockedRegFreeWinRT-AutoInitializer.cpp
    4 dev\WindowsAppRuntime_BootstrapDLL\MddBootstrapAutoInitializer.cpp

You already hit #2. Please do likewise for 1,3,4

@agniuks

agniuks commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator Author

/azp run

@agniuks
agniuks requested a review from DrusTheAxe March 23, 2026 16:27
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants