Problem with PRISM migration and Framework version

Topics: Prism v4 - WPF 4
Mar 14, 2014 at 10:01 AM
Edited Mar 14, 2014 at 10:13 AM
We have migrated to prism 4 from CAL

However after the migration, the views are not injected to regions when we run the application on a machine with .Net 4.0.
The same code however works well on a machine with .Net 4.5 installed. Could this be possibly due to PRISM or any other component we may be using.

This is how our module catalog looks like
<module assemblyFile="MyApp.Modules.MyApp.dll" moduleType="SomeNamespace.CustomerSoftware.SRP.Modules.MyApp.SE_WPF_ModuleSchematic" moduleName="Schematic"/>
<module assemblyFile="MyApp.Modules.MyApp.dll" moduleType="SomeNamespace.CustomerSoftware.SRP.Modules.MyApp.SE_WPF_ModuleFBGrid" moduleName="DataGrid"/>
<module assemblyFile="MyApp.Modules.MyApp.dll" moduleType="SomeNamespace.CustomerSoftware.SRP.Modules.MyApp.SE_WPF_ModuleNetwork" moduleName="Network">
  <dependencies>
    <dependency moduleName="Schematic"/>
    <dependency moduleName="DataTree"/>
    <dependency moduleName="DataGrid"/>
  </dependencies>
</module>
<module assemblyFile="MyApp.Modules.MyApp.dll" moduleType="SomeNamespace.CustomerSoftware.SRP.Modules.MyApp.SE_WPF_ModuleFBtree" moduleName="DataTree"/>
<module assemblyFile="MyApp.Modules.MyApp.dll" moduleType="SomeNamespace.CustomerSoftware.SRP.Modules.MyApp.SE_WPF_ModuleSolution" moduleName="DataSolution"/>
<module assemblyFile="MyApp.Modules.MyApp.dll" moduleType="SomeNamespace.CustomerSoftware.SRP.Modules.MyApp.SE_WPF_ModuleProtectionCurve" moduleName="Plot"/>
Under module Network view constructor the regions are associated to the control
        RegionManager.SetRegionName(this.SchematicContent, RegionNames.SchematicRegion);
        RegionManager.SetRegionManager(this.SchematicContent, this.regionManager);

        RegionManager.SetRegionName(this.TreeContent, RegionNames.TreeRegion);
        RegionManager.SetRegionManager(this.TreeContent, this.regionManager);

        RegionManager.SetRegionName(this.GridContent, RegionNames.GridRegion);
        RegionManager.SetRegionManager(this.GridContent, this.regionManager);
The constructor for the presenter of this module then assigns the views to these regions
        this.schematicRegion = this.regionManager.Regions[RegionNames.SchematicRegion];
        this.schematicView = AddCompositeView(typeof(ISE_WPF_ModuleSchematicView), typeof(ISE_WPF_ModuleSchematicPresenter), schematicRegion);
        this.schematicRegion.Activate(schematicView);

        this.propertiesRegion = this.regionManager.Regions[RegionNames.TreeRegion];
        this.treeView = AddCompositeView(typeof(ISE_WPF_ModuleFBtreeView), typeof(ISE_WPF_ModuleFBtreePresenter), propertiesRegion);
        this.solutionView = AddCompositeView(typeof(ISE_WPF_ModuleSolutionView), typeof(ISE_WPF_ModuleSolutionPresenter), propertiesRegion);
        this.PlotView = AddCompositeView(typeof(ISE_WPF_ModulePlotView), typeof(ISE_WPF_ModulePlotPresenter), propertiesRegion);
        this.propertiesRegion.Activate(this.treeView);


        this.gridRegion = this.regionManager.Regions[RegionNames.GridRegion];
        this.gridView = AddCompositeView(typeof(ISE_WPF_ModuleFBGridView), typeof(ISE_WPF_ModuleFBGridPresenter), gridRegion);
        this.gridRegion.Activate(this.gridView);

Developer
Mar 17, 2014 at 9:40 PM
Hi,

It's strange that the application is running correctly with .NET 4.5 and not with .NET 4 (if it was designed to run with both frameworks.) It might be possible that there is a component in your application that requires .NET 4.5 and that the application is failing silently when running in .NET 4, resulting in the views not being added in their corresponding regions.

It would be useful if you could provide us with more information regarding:
  1. What version of Prism are you using in you application.
  2. It seems that the views are being added to the regions using a AddCompositeView method. What does this method do exactly and what mechanism is it using to inject the view? (view injection, discovery, navigation, etc....)
Also, please check if there is any library or project in your application that has explicit references to .NET 4.5 assemblies.

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini