dansiegel / Prism.Magician.Docs

https://prismmagician.com/
1 stars 0 forks source link

CS0239: 'App.InitializeModules()': cannot override inherited member 'PrismApplication.InitializeModules()' because it is sealed #3

Closed SeriousM closed 3 years ago

SeriousM commented 3 years ago

Versions: Prism.Magican 8.1.9 Prism.DryIoc.Extensions 8.0.67

My app is inheriting from Prism.PrismApplication and the generated code from magican is generating a partial class that overrides InitializeModules. The problem is that PrismApplication is sealing the InitializeModules which leads to this error:

'App.InitializeModules()': cannot override inherited member 'PrismApplication.InitializeModules()' because it is sealed

PrismApplication code:

protected sealed override void InitializeModules()
{
    if (ModuleCatalog is null)
    {
        ModuleCatalog = Container.Resolve<IModuleCatalog>();
    }
    else
    {
        ((IContainerExtension)Container).RegisterInstance<IModuleCatalog>(ModuleCatalog);
    }

    if (ModuleCatalog.Modules.Any())
    {
        var manager = Container.Resolve<IModuleManager>();
        manager.LoadModuleCompleted += PrismApplication_LoadModuleCompleted;
        manager.Run();
    }
}

Magican generated code:

[GeneratedCodeAttribute("AbracadabraGenerator", "8.1.9+91b82caa14")]
protected override void InitializeModules()
{
    var manager = Container.Resolve<IModuleManager>();
    if (manager.Modules.Any())
    {
        manager.LoadModuleCompleted += (s,e) => OnLoadModuleCompleted(e);
        manager.Run();
    }
}
dansiegel commented 3 years ago

The Magician is not meant to be used with the Prism Container Extensions, it replaces it. Please use the official Prism packages instead.