PrismLibrary/Prism · error · ArgumentNullException

journal

Error message

journal

What it means

Thrown by the RegionNavigationService constructor when the IRegionNavigationJournal dependency is null. The journal tracks forward/back navigation for the region and the service immediately assigns Journal.NavigationTarget = this, so a null journal is rejected up front. Fail-fast guard on a required dependency.

Solutions

  1. Pass a valid IRegionNavigationJournal instance (Prism registers RegionNavigationJournal by default).
  2. Ensure UsePrism/PrismAppBuilder default registrations run before resolving the service.
  3. Correct parameter ordering in manual construction.

Example fix

// before
var svc = new RegionNavigationService(container, loader, null);
// after
var svc = new RegionNavigationService(container, loader, new RegionNavigationJournal());
Defensive patterns

Strategy: validation

Validate before calling

if (journal is null) throw new ArgumentNullException(nameof(journal));
var svc = new RegionNavigationService(container, loader, journal);

Type guard

bool IsValid(IRegionNavigationJournal j) => j is not null;

Prevention

When it happens

Trigger: Calling new RegionNavigationService(container, loader, null) or a container registration resolving IRegionNavigationJournal to null.

Common situations: Hand-rolled construction in tests, custom journal registrations that are missing, arguments passed out of order.

Related errors


AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15). Data as JSON: /api/errors/78df4a012f90221b. Report an issue: GitHub.

Appendix: source

Thrown at src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs:26

/// Provides navigation for regions.
/// </summary>
public class RegionNavigationService : IRegionNavigationService
{
    private readonly IContainerProvider _container;
    private readonly IRegionNavigationContentLoader _regionNavigationContentLoader;
    private NavigationContext _currentNavigationContext;

    /// <summary>
    /// Initializes a new instance of the <see cref="RegionNavigationService"/> class.
    /// </summary>
    /// <param name="container">The <see cref="IContainerExtension" />.</param>
    /// <param name="regionNavigationContentLoader">The navigation target handler.</param>
    /// <param name="journal">The journal.</param>
    public RegionNavigationService(IContainerExtension container, IRegionNavigationContentLoader regionNavigationContentLoader, IRegionNavigationJournal journal)
    {
        _container = container ?? throw new ArgumentNullException(nameof(container));
        _regionNavigationContentLoader = regionNavigationContentLoader ?? throw new ArgumentNullException(nameof(regionNavigationContentLoader));
        Journal = journal ?? throw new ArgumentNullException(nameof(journal));
        Journal.NavigationTarget = this;
    }

    /// <summary>
    /// Gets or sets the region.
    /// </summary>
    /// <value>The region.</value>
    public IRegion Region { get; set; }

    /// <summary>
    /// Gets the journal.
    /// </summary>
    /// <value>The journal.</value>
    public IRegionNavigationJournal Journal { get; private set; }

    /// <summary>
    /// Raised when the region is about to be navigated to content.
    /// </summary>

View on GitHub (pinned to 358118cd64)