When I tried running a WPF app that uses PRISM from a button add-in in ArcMap, the OnClick event goes as far as initializing and showing the Shell.xaml but when it tries to load the modules and the controls in the regions, I get this error:
Unable to cast transparent proxy to type ‘InnerModuleInfoLoader’
The button add-in has this for the onclick eventhandler:
protected override void OnClick()
{
App app = new App();
app.InitializeComponent();
app.Run();
}
In the App.xaml.cs then runs the bootstrapper OnStartUp:
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
Bootstrapper bootstrapper = new Bootstrapper();
bootstrapper.Run();
}
The modules are copied to the Add-In’s bin\Modules folder:
protected override IModuleCatalog CreateModuleCatalog()
{
var moduleCatalog = new DirectoryModuleCatalog();
moduleCatalog.ModulePath = @".\Modules";
return moduleCatalog;
}
The bootstrapper’s Run() method goes as far as initializing and showing the Shell:
protected override void InitializeShell()
{
base.InitializeShell();
App.Current.MainWindow = (Window)this.Shell;
App.Current.MainWindow.Show();
}
But on the part where it tries to load the modules and the controls into the regions, I get that error. The WPF app by itself runs fine, but when the button runs it, it doesn’t finish.
I’m not a prism expert, just trying this as a prototype for a next version, so any help will be appreciated.
Finally resolved this issue. The error message was basically telling me that it doesn’t know what “InnerModuleInfoLoader” was, so I tried placing the prism DLLs in the bin folder of the calling app (3rd party button add-in) and voila, it got past through the error message. We were hoping we did not have to put the DLLs in the GAC or in the 3rd party app/bin folder but I guess we would have to either place them in the GAC or maybe set the path in the EnvironmentVariable for the 3rd party app to find them.