Prism w / Mef Bootstrap Problem

I have a reference application that works, and now it has broken, and I cannot understand why. The code that gives me the problem is basically an exact copy of the Prism ModularityWithMef Quickstart example. The bootstrap module is an exact copy of Quickstart, with the exception of adding module discovery logic. Therefore, I do not include it here. The problem I encountered in Shell View code is an almost exact copy of QuickStart Shell Codebehind code. The code -

namespace MvvmRefVer
{
    using System.ComponentModel;
    using System.ComponentModel.Composition;
    using System.Diagnostics;
    using System.Globalization;
    using System.Windows;

    using Microsoft.Practices.Prism.Logging;
    using Microsoft.Practices.Prism.Modularity;

    [Export]
    public partial class Shell : Window, IPartImportsSatisfiedNotification
    {
        [Import(AllowRecomposition = false)]
        private CallbackLogger logger;

        [Import(AllowRecomposition = false)]
        private IModuleManager moduleManager;

        public Shell()
        {
            this.InitializeComponent();
        }

        public void OnImportsSatisfied()
        {
        }
        private void WindowClosing(object sender, CancelEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            this.moduleManager.LoadModule("NavigationViewControlModule");
        }
    }

The problem arises in this Bootstrapper function -

    protected override DependencyObject CreateShell()
    {
        var d =  this.Container.GetExportedValue<Shell>();
        return d;
    }

GetExportedValue [Import(AllowRecomposition = false)] moduleManager , Undefined Exception. "", , Manager.

, MEF, , . mef, , Prism Modularity .

+3
1

Undefined Exception .

MEF . MEF.

0

Source: https://habr.com/ru/post/1779272/


All Articles