Hi,
I went into what I think is a bug but I don't know if it's on devforce/cocktail side or caliburn side.
The applications works with many plugins, each one of these plugins is located in a different XAP.
Each XAP has a class which implement the interface ITest in order to do some initialization.
When the user click on a button, the application loads those XAP and call the method Initialize from ITest
Exemple of Initialize method :
public void Initialize(ICollection<object> list)
{
list.Add(new TestViewModel());
}
in the ShellView, I have a list of ITest which is injected by MEF with Allowrecomposition = True.
When the collection change, I call the method Initialize on all the ITest instance in my list.
the list parameter fo the Initialize method is in fact an ObservableCollection from my shellviewmodel which is binded in to an itemcontrol in the shellview.
The TestViewModel class has no code but has a TestView associated which only show the text "Hello Devforce".
when I start the application, and click on the button to download the XAP I get the message "Cannot find view for ...." but this View exist !!
I added a second button which, after the XAP been downloaded, will call Composition.GetInstances<ITest> and call the Initialize method on all the intances.
This time it works fine, caliburn bind and show the view .
Here is what I did notice :
1st case : when I enter in the Initialize method because of the recomposition
The AssemblySource.Instance list from caliburn has no trace of anything from the XAP I just downloaded.
2nd case : when I enter in the Initialize method after the GetInstances<ITest>
The AssemblySource.Instance list has trace of the viewModel, View ...
In the ViewLocator of Caliburn, it try to find the View in the AssemblySource.Instance. If it doesn't find it it show the message "can't find view for ....". So that explain why it doesn't' works with the recomposition
But to me it looks like a bug, the AssemblySource.Instance should have trace of everything yet since it did find the ITest Export.
Since I don't really understand who refresh this list because Devforce does the recomposition, can you enlight me on this "bug" ?
Here is a test application which reproduce the problem
Regards,
Walid.