{"record":{"id":"dc5cc8ca0c819f3d","repo":"LykosAI/StabilityMatrix","slug":"frame-not-found","errorCode":null,"errorMessage":"Frame not found","messagePattern":"Frame not found","errorType":"exception","errorClass":"NullReferenceException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml.cs","lineNumber":72,"sourceCode":"            {\n                Effect = SlideNavigationTransitionEffect.FromLeft,\n                FromHorizontalOffset = 200\n            }\n        };\n    \n    private static readonly FrameNavigationOptions DirectionlessNavigationOptions\n        = new()\n        {\n            TransitionInfoOverride = new SuppressNavigationTransitionInfo()\n        };\n    \n    /// <inheritdoc />\n    protected override void OnApplyTemplate(TemplateAppliedEventArgs e)\n    {\n        base.OnApplyTemplate(e);\n        \n        frame = e.NameScope.Find<Frame>(\"PART_Frame\") \n                ?? throw new NullReferenceException(\"Frame not found\");\n        \n        frame.NavigationPageFactory = new FrameNavigationFactory(SourcePageType);\n\n        if (SelectedItem is not null)\n        {\n            frame.NavigateFromObject(SelectedItem, DirectionlessNavigationOptions);\n        }\n    }\n\n    protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)\n    {\n        base.OnPropertyChanged(change);\n\n        if (frame is null) return;\n        \n        if (change.Property == SelectedItemProperty)\n        {\n            if (change.GetNewValue<object?>() is not { } value) return;","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Controls/FrameCarousel.axaml.cs#L54-L90","documentation":"FrameCarousel.OnApplyTemplate looks up the template part 'PART_Frame' (a Frame) in the applied template's name scope. If the part is absent, it throws NullReferenceException('Frame not found'), preventing navigation wiring (NavigationPageFactory and initial navigation) from completing.","triggerScenarios":"The FrameCarousel ControlTemplate lacks an element named 'PART_Frame', the template was overridden with a style that omits the part, or the Frame is not in the templated control's name scope.","commonSituations":"Custom re-templating of FrameCarousel that forgot the PART_Frame convention; theme assembly mismatch; renaming the part in a refactor.","solutions":["Include <Frame x:Name=\"PART_Frame\"/> in the FrameCarousel ControlTemplate","Verify the applied style/theme is the one intended for FrameCarousel","Preserve the 'PART_Frame' TemplatePart name in any custom template","Log/inspect e.NameScope in OnApplyTemplate to confirm which parts were found"],"exampleFix":"// before\n<ControlTemplate>\n  <Panel/>\n</ControlTemplate>\n// after\n<ControlTemplate>\n  <Frame x:Name=\"PART_Frame\"/>\n</ControlTemplate>","handlingStrategy":"validation","validationCode":"var frame = e.NameScope.Find<Frame>(\"PART_Frame\");\nif (frame is null) { Log.Error(\"PART_Frame missing from FrameCarousel template\"); return; }","typeGuard":"bool HasFramePart(TemplatedControl c) => c.Template != null;","tryCatchPattern":"try { frame = e.NameScope.Find<Frame>(\"PART_Frame\")!; }\ncatch (NullReferenceException ex) { Log.Error(ex, \"Frame part not found\"); }","preventionTips":["Always preserve PART_* naming when re-templating","Declare [TemplatePart(nameof(PART_Frame), typeof(Frame))] on the control","Add design-time/template unit tests that apply the template"],"tags":["avalonia","control-template","frame","null-reference"],"backgroundTag":"resource-not-found","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}