{"record":{"id":"28d2f06765e9ce19","repo":"PrismLibrary/Prism","slug":"container","errorCode":null,"errorMessage":"container","messagePattern":"container","errorType":"exception","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs","lineNumber":24,"sourceCode":"\n/// <summary>\n/// Provides navigation for regions.\n/// </summary>\npublic class RegionNavigationService : IRegionNavigationService\n{\n    private readonly IContainerProvider _container;\n    private readonly IRegionNavigationContentLoader _regionNavigationContentLoader;\n    private NavigationContext _currentNavigationContext;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"RegionNavigationService\"/> class.\n    /// </summary>\n    /// <param name=\"container\">The <see cref=\"IContainerExtension\" />.</param>\n    /// <param name=\"regionNavigationContentLoader\">The navigation target handler.</param>\n    /// <param name=\"journal\">The journal.</param>\n    public RegionNavigationService(IContainerExtension container, IRegionNavigationContentLoader regionNavigationContentLoader, IRegionNavigationJournal journal)\n    {\n        _container = container ?? throw new ArgumentNullException(nameof(container));\n        _regionNavigationContentLoader = regionNavigationContentLoader ?? throw new ArgumentNullException(nameof(regionNavigationContentLoader));\n        Journal = journal ?? throw new ArgumentNullException(nameof(journal));\n        Journal.NavigationTarget = this;\n    }\n\n    /// <summary>\n    /// Gets or sets the region.\n    /// </summary>\n    /// <value>The region.</value>\n    public IRegion Region { get; set; }\n\n    /// <summary>\n    /// Gets the journal.\n    /// </summary>\n    /// <value>The journal.</value>\n    public IRegionNavigationJournal Journal { get; private set; }\n\n    /// <summary>","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs#L6-L42","documentation":"Thrown by the RegionNavigationService constructor when the IContainerExtension dependency is passed as null. Prism requires the container to resolve views and services during region navigation, so a null container makes the service unusable. It is an eager fail-fast guard for an invalid constructor argument.","triggerScenarios":"Calling new RegionNavigationService(null, loader, journal) or a DI container resolving a null IContainerExtension registration when constructing the region navigation service.","commonSituations":"Manual instantiation of Prism internals in unit tests, custom container adapters that forget to register IContainerExtension, wrong constructor argument order.","solutions":["Register IContainerExtension in the container before the region navigation service is resolved (done automatically by PrismAppBuilder / UsePrism).","Pass the actual IContainerExtension instance from your container extension when constructing manually.","Check constructor argument order so the container is the first parameter."],"exampleFix":"// before\nvar svc = new RegionNavigationService(null, loader, journal);\n// after\nvar svc = new RegionNavigationService(containerExtension, loader, journal);","handlingStrategy":"validation","validationCode":"if (container is null) throw new ArgumentNullException(nameof(container));\nvar svc = new RegionNavigationService(container, loader, journal);","typeGuard":"bool IsValid(IContainerExtension c) => c is not null;","tryCatchPattern":null,"preventionTips":["Resolve Prism internals through the DI container instead of new-ing them up.","Register IContainerExtension before any service that depends on it.","Verify UsePrism/PrismAppBuilder initialization runs in MauiProgram."],"tags":["null-argument","constructor","prism","maui"],"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"}