Print Page | Close Window

Is this a real composition error ?

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3410
Printed Date: 06-May-2024 at 3:21pm


Topic: Is this a real composition error ?
Posted By: Walid
Subject: Is this a real composition error ?
Date Posted: 26-Apr-2012 at 4:22am
Hi,

I have some warning/error message in the Logs and I would like to know if they are "normal" or should be treated (how ?).

The application doesn't know the model, after the login we download a XAP file which have 3 assemblies. One for the model, one named services where the UOF, connectionsoptions, etc are located and the last one having the view/viewmodels and providing few other services
In this last one, one service (named CompanyRequirementVerificator, see below) need to import a UOW. 

The Log below are shown just before the call of UpdateAssemblySourceFromCatalog
 in the FrameworkBootstrapper.OnCatalogRecomposed methode.


'iexplore.exe' (Silverlight) : 'MyApp.Commun.Services' chargé, symboles chargés.
'iexplore.exe' (Silverlight) : 'c:\Program Files (x86)\Microsoft Silverlight\5.0.61118.0\fr\mscorlib.debug.resources.dll' chargé
'iexplore.exe' (Silverlight) : 'MyApp.Commun.Domain.SL' chargé, symboles chargés.
'iexplore.exe' (Silverlight) : 'MyApp.Context.AutoLoad' chargé, symboles chargés.
System.ComponentModel.Composition Warning: 1 : The ComposablePartDefinition 'MyApp.Context.AutoLoad.Verificators.EtablissementRequirementVerificator' has been rejected. The composition remains unchanged. The changes were rejected because of the following error(s): The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) No valid exports were found that match the constraint '((exportDefinition.ContractName == "MyApp.Interfaces.Repositories.IUnitOfWorkManager(MyApp.Commun.Services.UnitsOfWork.ISelectionEtbUnitOfWork)") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "MyApp.Interfaces.Repositories.IUnitOfWorkManager(MyApp.Commun.Services.UnitsOfWork.ISelectionEtbUnitOfWork)".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.

Resulting in: Cannot set import 'MyApp.Context.AutoLoad.Verificators.EtablissementRequirementVerificator..ctor (Parameter="unitOfWorkManager", ContractName="MyApp.Interfaces.Repositories.IUnitOfWorkManager(MyApp.Commun.Services.UnitsOfWork.ISelectionEtbUnitOfWork)")' on part 'MyApp.Context.AutoLoad.Verificators.EtablissementRequirementVerificator'.
Element: MyApp.Context.AutoLoad.Verificators.EtablissementRequirementVerificator..ctor (Parameter="unitOfWorkManager", ContractName="MyApp.Interfaces.Repositories.IUnitOfWorkManager(MyApp.Commun.Services.UnitsOfWork.ISelectionEtbUnitOfWork)") -->  MyApp.Context.AutoLoad.Verificators.EtablissementRequirementVerificator -->  AssemblyCatalog (Assembly="MyApp.Context.AutoLoad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")



later, after the call to UpdateAssemblySourceFromCatalog, have those Logs :



168 : 25/04/2012 20:08:41 :  : IdeaBlade.EntityModel.WcfProxy`1:CreateProxyCore : Trying programmatic configuration of EntityServer+SecurityFake
169 : 25/04/2012 20:08:41 :  : IdeaBlade.EntityModel.WcfProxy`1:CreateProxyCore : Created proxy to EntityServer+SecurityFake using Uri http://localhost:9010/EntityServer+SecurityFake.svc/sl
170 : 25/04/2012 20:08:41 :  : Cocktail.PartLocator`1:WriteTrace : Probed for service with contract IAuthenticationService and found MyApp.Application.Authentication.MyAppAuthenticationService
171 : 25/04/2012 20:08:42 :  : Cocktail.LogFns:DebugWriteLine : MyApp.Application.AppBootstrapper+<LoadModulesCore>d__8:MoveNext: Chargement des modules : AutoLoad, LaunchPoint
172 : 25/04/2012 20:08:42 :  : Cocktail.PartLocator`1:WriteTrace : Probed for service with contract IAuthenticationService and found MyApp.Application.Authentication.MyAppAuthenticationService
173 : 25/04/2012 20:08:42 :  : Cocktail.DefaultDebugLogger:LogWriter : Screen INFO: Deactivating MyApp.Application.ViewModels.Login.LoginViewModel.
174 : 25/04/2012 20:08:42 :  : Cocktail.DefaultDebugLogger:LogWriter : Screen INFO: Closed MyApp.Application.ViewModels.Login.LoginViewModel.
175 : 25/04/2012 20:08:42 :  : Cocktail.DefaultDebugLogger:LogWriter : Coroutine INFO: Coroutine execution completed.
176 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:LoadCatalogCore : Error loading assembly 'MyApp.Commun.Services.dll' for PartsCatalog, but will retry.  Initial error: Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.
=> Translation is : Impossible to load one or many of the required type.
177 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:LoadCatalogCore : Assembly 'MyApp.Commun.Domain.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' added to PartsCatalog
178 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:LoadCatalogCore : Assembly 'MyApp.Context.AutoLoad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' added to PartsCatalog
179 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:LoadCatalogCore : Assembly 'MyApp.Commun.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' added to PartsCatalog
180 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:LoadCatalog : Probe assemblies found in dynamic content: MyApp.Commun.Domain.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null :: MyApp.Context.AutoLoad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null :: MyApp.Commun.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
181 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:OnRecomposed : Dynamic content added: MyApp.Context.AutoLoad.xap, loaded without error

As you can see, it say on the line 181 all is done without error. And it's true as I can use the module CompanyRequirementVerificator which generated the first warning.

I did another test. I removed the Model from the XAP and added a reference to it in the main application. In this case I have no error in the logs.





Replies:
Posted By: Walid
Date Posted: 26-Apr-2012 at 4:28am
Why aren't we allowed to edit our own post in the cocktail forum ?

-------------


Posted By: mgood
Date Posted: 26-Apr-2012 at 7:07am
Walid,
There's an issue in the underlying DevForce XAP functionality that Cocktail relies on. It will be fixed in the next version of DevForce scheduled to ship on May 2. In the meantime you can work around the issue by adding the following to your bootstrapper.
 
        protected override ComposablePartCatalog PrepareCompositionCatalog()
        {
            // Create alternative AggregateCatalog to group recomposition events.
            var currentCatalogs = Composition.AggregateCatalog.Catalogs.ToList();
            var catalog = new AggregateCatalog();
 
            // Add current catalogs as a single group
            catalog.Catalogs.Add(new AggregateCatalog(currentCatalogs));
            Composition.Recomposed +=
                (sender, args) =>
                {
                    // Find new catalogs.
                    var newCats =
                        Composition.AggregateCatalog.Catalogs.Where(c => !currentCatalogs.Contains(c)).ToList();
                    currentCatalogs.AddRange(newCats);
 
                    // Add new catalogs as a single group
                    catalog.Catalogs.Add(new AggregateCatalog(newCats));
                };
 
            return catalog;
        }


Posted By: Walid
Date Posted: 26-Apr-2012 at 7:26am
to have the interception I changed

        return catalog;

by
            InterceptionConfiguration cfg = new InterceptionConfiguration().AddInterceptor(this);
            return new InterceptingCatalog(catalog, cfg);


It did correct the first error but not the second one
176 : 25/04/2012 20:08:42 :  : IdeaBlade.Core.Composition.PartsCatalog:LoadCatalogCore : Error loading assembly 'MyApp.Commun.Services.dll' for PartsCatalog, but will retry.  Initial error: Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.
=> Translation is : Impossible to load one or many of the required type.
I have the error in every xxx.Services assemblies (in others XAP).


-------------


Posted By: mgood
Date Posted: 26-Apr-2012 at 7:38am
You can ignore this one. Depending on your reference dependencies between the assemblies in the XAP it's not always possible to load them all in the first pass. As the message states, it will retry. Given that you no longer have composition errors, it succeded the second time. You can try cleaning up unused references, which may make the error go away.


Posted By: Walid
Date Posted: 26-Apr-2012 at 7:55am
ok thank you marcel.


-------------


Posted By: mgood
Date Posted: 26-Apr-2012 at 8:27am
Originally posted by Walid

Why aren't we allowed to edit our own post in the cocktail forum ?
 
Looks like the permissions are set wrong for the Cocktail forum. We are fixing it.


Posted By: JoshO
Date Posted: 26-Apr-2012 at 9:46am
Originally posted by Walid

Why aren't we allowed to edit our own post in the cocktail forum ?
 
Two permissions - Edit and Delete - did not propagate to this new forum. That has been corrected and all registered users now have those rights. My appologies for the error!



Print Page | Close Window