{"record":{"id":"c4785c49b7c32888","repo":"PrismLibrary/Prism","slug":"configuresegment","errorCode":null,"errorMessage":"configureSegment","messagePattern":"configureSegment","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/Builder/TabbedSegmentBuilder.cs","lineNumber":63,"sourceCode":"\n    public string Segment => BuildSegment();\n\n    public ITabbedSegmentBuilder AddSegmentParameter(string key, object value)\n    {\n        _parameters.Add(key, value);\n        return this;\n    }\n\n    public ITabbedSegmentBuilder UseModalNavigation(bool useModalNavigation)\n    {\n        return AddSegmentParameter(KnownNavigationParameters.UseModalNavigation, useModalNavigation);\n    }\n\n    public ITabbedSegmentBuilder CreateTab(Action<ICreateTabBuilder> configureSegment)\n    {\n        if (configureSegment is null)\n        {\n            throw new ArgumentNullException(nameof(configureSegment));\n        }\n\n        var builder = new CreateTabBuilder(((IRegistryAware)_builder).Registry);\n        configureSegment(builder);\n        return AddSegmentParameter(KnownNavigationParameters.CreateTab, builder.Segment);\n    }\n\n    public ITabbedSegmentBuilder SelectedTab(string segmentName)\n    {\n        return AddSegmentParameter(KnownNavigationParameters.SelectedTab, segmentName);\n    }\n\n    public ITabbedSegmentBuilder Title(string title)\n    {\n        return AddSegmentParameter(KnownNavigationParameters.Title, title);\n    }\n\n    private string BuildSegment()","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/Builder/TabbedSegmentBuilder.cs#L45-L81","documentation":"TabbedSegmentBuilder.CreateTab(Action<ICreateTabBuilder>) validates its configureSegment delegate with ArgumentNullException. Passing a null delegate throws immediately; the exception's parameter name is \"configureSegment\".","triggerScenarios":"Calling `tabbedBuilder.CreateTab(null)` or forwarding a null callback from your own helper method into CreateTab.","commonSituations":"Wrapping CreateTab in a helper with an optional Action parameter that defaults to null; dynamic code paths that skip building the delegate.","solutions":["Always pass a non-null delegate; if no configuration is needed pass a no-op: `b => { }`.","Guard your own helper methods before forwarding the delegate to CreateTab.","Fix the caller that computes the delegate to ensure it isn't null."],"exampleFix":"// before\ntabbedBuilder.CreateTab(null); // ArgumentNullException\n// after\ntabbedBuilder.CreateTab(b => { });\n// or guard:\nif (configure is null) throw new ArgumentNullException(nameof(configure));","handlingStrategy":"validation","validationCode":"if (configureSegment is null)\n    throw new ArgumentNullException(nameof(configureSegment));\ntabbedBuilder.CreateTab(configureSegment);","typeGuard":"bool HasConfigurator(Action<ICreateTabBuilder> a) => a is not null;","tryCatchPattern":"try { tabbedBuilder.CreateTab(configureSegment); }\ncatch (ArgumentNullException ex) when (ex.ParamName == \"configureSegment\")\n{\n    tabbedBuilder.CreateTab(b => { }); // no-op configuration\n}","preventionTips":["Default optional Action parameters to `b => { }` instead of null","Never forward possibly-null delegates into Prism builder APIs","Enable nullable reference types (Action<ICreateTabBuilder>?) to catch this at compile time"],"tags":["prism","maui","navigation","null-argument","tabbedpage"],"backgroundTag":"null-argument","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}