PrismLibrary/Prism · error · NotSupportedException

Specified method is not supported.

Error message

Specified method is not supported.

What it means

ModuleManager.ModuleDownloadProgressChanged is an event whose add accessor throws NotSupportedException in Prism.Maui, because downloading module assemblies on demand is not supported on MAUI. Subscribing to the event (+=) throws 'Specified method is not supported.'

Solutions

  1. Remove the event subscription in MAUI code
  2. Guard platform-specific code with #if directives or partial classes
  3. Track module initialization progress via your own logging around ModuleManager.Run/LoadModule instead

Example fix

// before
moduleManager.ModuleDownloadProgressChanged += OnDownloadProgress;
// after
#if WINDOWS_WPF
moduleManager.ModuleDownloadProgressChanged += OnDownloadProgress;
#endif
Defensive patterns

Strategy: type-guard

Validate before calling

// guard before subscribing
if (OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst())
    return; // ModuleDownloadProgressChanged unsupported on MAUI
moduleManager.ModuleDownloadProgressChanged += OnProgress;

Type guard

bool SupportsDownloadEvents(object manager) => manager is not global::Prism.Maui.Modularity.ModuleManager;

Try / catch

try
{
    moduleManager.ModuleDownloadProgressChanged += OnProgress;
}
catch (NotSupportedException)
{
    // Event not supported on MAUI — skip progress UI
}

Prevention

When it happens

Trigger: moduleManager.ModuleDownloadProgressChanged += Handler; — any subscription attempt, typically code shared with or copied from Prism.Wpf where the event exists.

Common situations: Porting WPF Prism apps using download-on-demand modules to MAUI; shared helper classes that wire up module progress UI on all platforms.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at src/Maui/Prism.Maui/Modularity/ModuleManager.cs:31

    /// </summary>
    protected IModuleCatalog ModuleCatalog { get; }

    /// <summary>
    /// Gets all the <see cref="IModuleInfo"/> classes that are in the <see cref="IModuleCatalog"/>.
    /// </summary>
    public IEnumerable<IModuleInfo> Modules => ModuleCatalog.Modules;

    /// <summary>
    /// Raised when a module is loaded or fails to load.
    /// </summary>
    public event EventHandler<LoadModuleCompletedEventArgs> LoadModuleCompleted;

    /// <summary>
    /// Not used by Prism.Maui
    /// </summary>
    public event EventHandler<ModuleDownloadProgressChangedEventArgs> ModuleDownloadProgressChanged
    {
        add => throw new NotSupportedException();
        remove => throw new NotSupportedException();
    }

    /// <summary>
    /// The module initializer.
    /// </summary>
    protected IModuleInitializer ModuleInitializer { get; }

    /// <summary>
    /// Initializes an instance of the <see cref="ModuleManager"/> class.
    /// </summary>
    /// <param name="moduleInitializer">Service used for initialization of modules.</param>
    /// <param name="moduleCatalog">Catalog that enumerates the modules to be loaded and initialized.</param>
    public ModuleManager(IModuleInitializer moduleInitializer, IModuleCatalog moduleCatalog)
    {
        ModuleInitializer = moduleInitializer ?? throw new ArgumentNullException(nameof(moduleInitializer));
        ModuleCatalog = moduleCatalog ?? throw new ArgumentNullException(nameof(moduleCatalog));
    }

View on GitHub (pinned to 358118cd64)