From 154ab3d8f2ebdc9b938f04c50445a3bfee58127c Mon Sep 17 00:00:00 2001 From: ET Date: Wed, 18 Feb 2026 14:58:45 -0800 Subject: [PATCH] WpfGfx: Mitigate RemoveChild crash - Preserve original behavior and comments where applicable - Public-safe wording (no internal IDs or repository names) --- .../src/WpfGfx/core/resources/node.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/resources/node.cpp b/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/resources/node.cpp index a698be83217..c711cf11591 100644 --- a/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/resources/node.cpp +++ b/src/Microsoft.DotNet.Wpf/src/WpfGfx/core/resources/node.cpp @@ -320,6 +320,14 @@ CMilVisual::RemoveChild( if (!m_rgpChildren.Remove(pChild)) { + // We've seen a handful of Watson dumps where incoming child is already detached + // from parent and about to be deleted by the next MilCmdChannelDeleteResource + // command. There are no known repros. For now we'll pretend we processed it. + if (pChild->GetParent() == NULL) + { + return S_OK; + } + IFC(E_INVALIDARG); }