PrismLibrary/Prism · error · NotImplementedException

The method or operation is not implemented.

Error message

The method or operation is not implemented.

What it means

Region.NavigationService's setter is intentionally unimplemented and always throws NotImplementedException. The navigation service is populated by Prism's region behaviors, not by user code; the getter returns the injected service. Assigning the property directly is not a supported operation.

Solutions

  1. Remove the assignment — region behaviors inject the navigation service automatically.
  2. To customize, register the RegionNavigationRegistration behavior via the region behavior factory in a custom IRegionAdapter / container registration.
  3. In tests, mock IRegionNavigationService and let Prism's behaviors attach it rather than assigning the property.

Example fix

// before
region.NavigationService = myNavigationService;
// after
// rely on Prism behaviors; if customizing, register the behavior:
regionBehaviors.AddIfMissing<RegionNavigationRegistrationBehavior>();
Defensive patterns

Strategy: validation

Validate before calling

// Never assign; verify the navigation service was injected by Prism behaviors:
if (region.NavigationService is null)
    throw new InvalidOperationException("Navigation service not attached by region behaviors");

Prevention

When it happens

Trigger: Writing region.NavigationService = someService in application or test code.

Common situations: Custom region adapters trying to wire navigation manually; code ported from older Prism versions where the property behaved differently; developers attempting to substitute a mock navigation service in tests.

Related errors


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

Appendix: source

Thrown at src/Maui/Prism.Maui/Navigation/Regions/Region.cs:166

    public IRegionManager RegionManager
    {
        get => _regionManager;
        set => SetProperty(ref _regionManager, value);
    }

    /// <summary>
    /// Gets the collection of <see cref="IRegionBehavior"/>s that can extend the behavior of regions.
    /// </summary>
    public IRegionBehaviorCollection Behaviors { get; }

    /// <summary>
    /// Gets the navigation service.
    /// </summary>
    /// <value>The navigation service.</value>
    public IRegionNavigationService NavigationService
    {
        get => _regionNavigationService;
        set => throw new NotImplementedException();
    }

    /// <summary>
    /// Gets the collection with all the views along with their metadata.
    /// </summary>
    /// <value>An <see cref="ObservableCollection{T}"/> of <see cref="ItemMetadata"/> with all the added views.</value>
    protected virtual ObservableCollection<ItemMetadata> ItemMetadataCollection
    {
        get
        {
            if (_itemMetadataCollection == null)
            {
                _itemMetadataCollection = new ObservableCollection<ItemMetadata>();
            }

            return _itemMetadataCollection;
        }
    }

View on GitHub (pinned to 358118cd64)