CompositionTarget::GetCompositorForCurrentThread: don't originate an error during core shutdown - #11731
Open
Abhijeet Jha (iamAbhi-916) wants to merge 1 commit into
Conversation
…error during core shutdown Cleanup running through DXamlCore::ShutdownAllPeers can query the compositor and handles the failure itself. Originating the expected RPC_E_WRONG_THREAD there makes FailFastOnErrors terminate the process during normal shutdown.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Abhijeet Jha (iamAbhi-916)
marked this pull request as ready for review
August 31, 2026 15:37
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
Author
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
| // and handles the failure itself, so don't originate an error for it. | ||
| if (pdxc && DXamlCore::IsShuttingDownStatic()) | ||
| { | ||
| return CheckActivationAllowed(); |
Contributor
There was a problem hiding this comment.
Dropping IFC_RETURN will just avoid storing stowed exception which in turn may impact debugging as we won't be having a stowed exception captured in case of a real failure
|
|
||
| // Cleanup running during core shutdown through ShutdownAllPeers() can query the compositor | ||
| // and handles the failure itself, so don't originate an error for it. | ||
| if (pdxc && DXamlCore::IsShuttingDownStatic()) |
Contributor
There was a problem hiding this comment.
Can't we avoid calling this if shutting down?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
An app that enables
DebugSettings.FailFastOnErrorsand uses AcrylicBrush fail-fasts with 0xC000027B during normal shutdown. Dev Home hits this on every exit.The stowed exception is hr=8001010E (RPC_E_WRONG_THREAD) originated at CompositionTarget.cpp:227, in the destructor of a brush that XAML is itself tearing down.
Root cause:
DXamlCore::DeinitializeInstancesetsm_state = Deinitializing(DXamlCore.cpp:1026) and then runsCommonShutdown->ShutdownAllPeers, which releases peers and destroys the brush.The HRESULT is correct and the caller already handles it. The defect is that an expected teardown condition is originated as a failure, and
FailFastOnErrorscannot tell the two apart.Fix:
Return the HRESULT without originating it when this thread's core is shutting down.
Behavior:
Callers on a live core are unaffected and still get a Compositor.
A query during core shutdown returns RPC_E_WRONG_THREAD to the caller exactly as before, and no longer originates an error context, so
FailFastOnErrorsdoes not fire.A query from a thread that has no core still fails fast.
Testing:
Repro'd locally in a WinUI 3 app, merge base against the fix, one process per case, swapping only Microsoft.ui.xaml.dll (amd64chk).
Acrylic has to actually render for the bug to arm:
MaterialHelper::m_acrylicCompositoris only set inAssertUniqueCompositorOrUpdate, which the solid-colour fallback path never reaches, so the repro forces the real acrylic path throughMaterialHelperTestApi.IgnoreAreEffectsFastand exits with the brush still in the live tree.Exactly one cell changes. Row 2 confirms the crash requires the
FailFastOnErrorsopt-in, rows 3 and 5 confirm the diagnostic is preserved outside the shutdown window.