From 18a063795b1a04860c719e3178ed47e8c366254f Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 19 May 2026 14:03:44 -0400 Subject: [PATCH] DYN-10493: Fix crash in Getting Started guided tour when advancing to step 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `HighlightPort` passes the result of `ContainerFromItem` through `ChildOfType` to `CreateRectangle`. `ContainerFromItem` can return null when the ItemsControl hasn't generated containers yet — a timing race exposed by PR #16883 (DYN-7760) which added synchronous WebView2 extension-closing before tour startup. The null reached `NameScope.SetNameScope` and threw `ArgumentNullException("dependencyObject")`. Guard: if `mainGrid` is null, return early and skip the port highlight rather than crash. The tour continues without the visual effect. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs b/src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs index 9e4fde446a3..d776cb42f20 100644 --- a/src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs +++ b/src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs @@ -697,10 +697,13 @@ internal static void HighlightPort(Step stepInfo, StepUIAutomation uiAutomationD //Once we have the ItemsControl we get the ContentPresenter var inputViewModel = inPorts.FirstOrDefault(x => x.PortName == (string)uiAutomationData.Parameters[3]); var dependencyObject = itemsControlPort.ItemContainerGenerator.ContainerFromItem(inputViewModel); - - Grid mainGrid = dependencyObject.ChildOfType(); + // ContainerFromItem returns null when the ItemsControl hasn't generated the + // container yet (e.g. timing race during guided-tour initialization). Skip the + // highlight rather than crash — the tour can continue without it. + if (mainGrid == null) return; + if (enableFunction) { //Creates the highlight rectangle so it can be added and shown over the port