Overriding AddServices() results in exception?!

Topics: CAB & Smart Client Software Factory
Jan 19, 2006 at 11:37 AM
originally posted by: SkreetchinTires

Hey guys,

While I was trying to implement our own UIExtensionSites, etc., I was wanting to simulate the CABs implementation, just with our stuff. However, whenever I override AddServices() as in the documentation:

...In ShellApplication : FormShellApplication<ShellWorkItem, ShellForm>

protected override void AddServices()
{
// The RIAUIElementAdapterFactoryCatalog will contain factories which
// create RIA-extended RIAUIElementAdapters which give us more control
// over building and managing menus and toolbars.
RootWorkItem.Services.AddNew<RIAUIElementAdapterFactoryCatalog, IRIAUIElementAdapterFactoryCatalog>();
}
I receive an exception during the Building of the RootWorkItem on application startup. Here is the exception information:

Service Microsoft.Practices.CompositeUI.WinForms.IControlActivationService is not available in the current context.

at Microsoft.Practices.CompositeUI.Collections.ServiceCollection.Get(Type serviceType, Boolean ensureExists) in C:\Program Files\Microsoft Composite UI App Block\CSharp\Source\CompositeUI\Collections\ServiceCollection.cs:line 300
.
.
.
Does anyone know If I missed something? I have not been able to track this down yet. I'ld be glad to help anyone with Ifragistics based Workspaces and thier NUnit tests....

Thanks!
Jan 20, 2006 at 7:34 AM
originally posted by: SkreetchinTires

Never Mind. The base.AddServices() method needed to be called. This is where IControlActivationService was added to the Services collection of the workitem.