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