Silverlight MEF application doesn't work called remotely after deploy RRS feed

  • Question

  • Hi.

    My Silverlight aplication which uses MEF after deploying to WWW server and then run remotely from my browser stops working.
    (when launched from WWW serwe browser is all fine)

    Here is MEF initialization in App.xaml.cs:

    _AppAggregateCatalog = new AggregateCatalog();
    AssemblyCatalog catalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
    catalog = new AssemblyCatalog(typeof(THBZasoby.Common.Base.Model).Assembly);
    CompositionContainer container = new CompositionContainer(_AppAggregateCatalog);

    All pointed assemblies are in the same main XAP.

    Then here is how looks my ViewModelLocator:

    public class ViewModelLocator
            public ViewModelLocator()

            public BranchDetailsVM BranchDetails
                    return _BranchDetails.Value;
            [Import(RequiredCreationPolicy = CreationPolicy.NonShared)]
            private Lazy<BranchDetailsVM> _BranchDetails { get; set; }


    Here one of view models:
    public class BranchDetailsVM : PageViewModelBase
            public BranchDetailsVM(IMessagesService messagesService, IBranchService dataService)
                _MessagesService = messagesService;
                _DataService = dataService;
            } (..)

    I could resolve few first exceptions by changing private imported by MEF fields into public properties (don't know why this helper but did..). But this approach doesnt work on Lazy properties in ViewModelLocator, locator doesn't return to views any view models.

      <loadFromRemoteSources enabled="true"/>
    to web.config didn't help (added it also to app.config in main SL project)

    Any tip why working applicetion after deploy behaves so poorly ?

    Cheras, Rafal.


    Wednesday, June 27, 2012 2:24 PM


  • Problem resolved - just in PageViewModel i still had private filds imported by MEF - had to change them into public imports ..
    • Marked as answer by Rafal.R Thursday, June 28, 2012 9:38 AM
    Thursday, June 28, 2012 9:38 AM