{"record":{"id":"3cc9922569cd7598","repo":"PrismLibrary/Prism","slug":"module-reference-location-is-not-supported-in-maui","errorCode":null,"errorMessage":"Module Reference Location is not supported in Maui","messagePattern":"Module Reference Location is not supported in Maui","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Modularity/ModuleInfo.cs","lineNumber":147,"sourceCode":"    /// </summary>\n    /// <value>The list of modules that this module depends upon.</value>\n    public Collection<string> DependsOn\n    {\n        get => _dependsOn ?? (_dependsOn = new Collection<string>());\n        set => _dependsOn = value;\n    }\n\n    /// <summary>\n    /// Specifies on which stage the Module will be initialized.\n    /// </summary>\n    public InitializationMode InitializationMode { get; set; }\n\n    /// <summary>\n    /// Reference to the location of the module assembly. Not Supported by Microsoft.Maui\n    /// </summary>\n    string IModuleInfo.Ref\n    {\n        get => throw new NotSupportedException(Resources.ModuleRefLocationNotSupported);\n        set { }\n    }\n\n    /// <summary>\n    /// Gets or sets the state of the <see cref=\"ModuleInfo\"/> with regards to the module loading and initialization process.\n    /// </summary>\n    public ModuleState State { get; private set; }\n\n    /// <summary>\n    /// Gets or sets the state of the <see cref=\"ModuleInfo\"/> with regards to the module loading and initialization process.\n    /// </summary>\n    ModuleState IModuleInfo.State\n    {\n        get => State;\n        set => State = value;\n    }\n}\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Modularity/ModuleInfo.cs#L129-L165","documentation":"In Prism.Maui, the explicit interface implementation IModuleInfo.Ref getter always throws NotSupportedException because module-on-demand download via a ref/file location is not supported on MAUI. The setter is intentionally a no-op. Reading the Ref property of any ModuleInfo through the IModuleInfo interface will throw.","triggerScenarios":"Casting a Prism.Maui ModuleInfo to IModuleInfo and reading .Ref; code written for WPF/Prism desktop module loading (Ref=\"file://...\") ported to MAUI; serialization or scanning code enumerating all IModuleInfo properties.","commonSituations":"Migrating WPF Prism modular apps to MAUI; generic tooling or DI scans that read every interface property; copying module catalog code from Prism.Wpf samples.","solutions":["Remove code that reads or sets IModuleInfo.Ref in the MAUI app","Deliver module assemblies as part of the app package instead of ref-based on-demand download","Use #if or separate catalogs to share catalog-building code between WPF and MAUI targets"],"exampleFix":"// before\nstring path = ((IModuleInfo)moduleInfo).Ref;\n// after\n// MAUI does not support module Ref locations\nvar path = moduleInfo.ModuleType.Assembly.Location;","handlingStrategy":"type-guard","validationCode":"if (moduleInfo is IModuleInfo mi && SupportsModuleRef(mi))\n    Console.WriteLine(mi.Ref);\nelse\n    Console.WriteLine(\"Ref not supported on MAUI\");","typeGuard":"bool SupportsModuleRef(IModuleInfo mi) => mi is not global::Prism.Maui.Modularity.ModuleInfo; // MAUI ModuleInfo throws on Ref","tryCatchPattern":"try\n{\n    var reference = ((IModuleInfo)moduleInfo).Ref;\n}\ncatch (NotSupportedException)\n{\n    // MAUI does not support module ref locations; fall back to embedded assembly\n}","preventionTips":["Do not read IModuleInfo.Ref in MAUI targets; conditionally compile desktop-only module-download code","Ship module assemblies inside the MAUI app package","Keep MAUI and WPF module catalogs in separate partials/files"],"tags":["unsupported-operation","modularity","maui","platform-limitation"],"backgroundTag":"unsupported-operation","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"}