OK, so I've got an existing Prism v1 app that we're looking ahead to see if things will work OK on .NET 4, Prism v2, and VS2010. I can run this "Hello World" Prism v2 application by
Edward Tanguay (http://www.tanguay.info/web/index.php?pg=howtos&id=15&layout=print) targeted to on .NET 4 and VS2010 just fine, but when I apply the necessary changes to migrate our existing application to the
newer tools it fails to instantiate the Shell correctly. As a last ditch effort, I gutted the existing project and added a new shell called Shell2 which is identical to the Hello World application and even that empty shell fails. I'm thinking there must be
a problem with my project settings... I've triple checked the references to make sure everything is pointed to the new prism assemblies that I built (targeted also to .NET 4, in case that matters) and everything seels to be identical to the working Hello World
I can step through the entire user code from the beginning of my App.xaml.cs and everything proceeds exactly the same way as Edward's Hello World app every other Prism v2 app, right up until it tries to create my shell.
The exception I'm getting when the bootstrapper calls CreateShell() is the following:
protected override DependencyObject CreateShell()
Shell2 shell2 = new Shell2(); // exception thrown here
Resolution of the dependency failed, type = "Microsoft.Practices.ServiceLocation.IServiceLocator", name = "". Exception message is: The current build operation (build key Build Key[Microsoft.Practices.Composite.UnityExtensions.UnityServiceLocatorAdapter,
null]) failed: ReadOnlyPermissionSet objects may not be modified. (Strategy type BuildPlanStrategy, index 3)
Drilling down into the inner exception gives the error occurring at line 6 column 20 of Shell2.xaml, given below
Title="Hello World" Height="300" Width="300">
<ItemsControl Name="MainRegion" cal:RegionManager.RegionName="MainRegion" />
Interesting fact, if I switch the positions of the attributes in ItemsControl, the exception follows the Name="MainRegion" statement (from column 20 to column 62 or some such). But, of course if I remove that attribute then of course any modules
I try to load fail since the MainRegion doesn't exist anymore :) In any case, it seems to be having problems with my naming the ItemsControl.
My question is: Are there any known issues with migrating from .NET 3.5 and Prism v1 to .NET 4 and Prism v2 that would cause this exception? At this point I'm ready to try recreating the solution project-by-project, module-by-module starting with the working
Hello World prism v2 code and adding my modules one at a time.