first_page

Songhay Studio: MEF imperative Exports broke Prism, Region-based Navigation system

The instance of NavigationResult in the “navigation callback” of IRegionManager.RequestNavigate() returned an “object reference not set to an instance of an object” (null reference) exception as Navigation failed “silently.” This exception disappeared after several hours of investigation when imperative Exports were removed:

#region builders:

var rflContext = new RegistrationBuilder();
    rflContext
        .ForType<IndexView>().Export<IndexView>(builder => builder.AsContractName("IndexView"));

var rflContextForModelContextModule = new RegistrationBuilder();
    rflContextForModelContextModule
        .ForTypesDerivedFrom<IRestModelContextService>().Export<IRestModelContextService>();

#endregion

Using attribute-based Export declarations stopped Navigation from failing silently.

https://github.com/BryanWilhite/