Recipe Framework Error when adding page with presenter.

Topics: Web Client Software Factory
Jun 28 2011 at 3:14 PM

I have a solution built with wcsf 2010 & vs 2010 that has been running in a production environment for several months now.  However, I need to add additional pages but receive the following error when: adding page with presenter, adding master page with presenter or adding user control with presenter.

Recipe Framework Error.  The wizard failed to execute. The error was: Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.IType.'

I have not touched the code since March and everything has worked fine up until now.  I can add a page with presenter no problem in another solution with identical architecture.  I'm running Windows XP SP3.

Please help. Thanks.

Jun 28 2011 at 3:29 PM

I am currently using a workaround which is to create a page with presenter in a different project then manually create the aspx page, presenter and view, copy & paste the code then change the namespaces.  Definitely a pain in the behind.  Would like to use the wizard again.

Jun 28 2011 at 8:14 PM

Hi,

You might find the following threads useful, as they deal with similar scenarios:

In case you can't find a solution to your problem by checking the aforementioned links, you could create a work item in the issue tracker describing the issue, so the team can reviewed it on a future release.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

Dec 7 2011 at 6:27 PM

Hi,

The links provided were of no help whatsoever.  I have created a work item in the issue tracker.

The problem seems to "jump" from one solution to the next.  For example, I have 3 solutions: A, B, and C.  The problem occurred in A but not B or C.  Then, I noticed the problem in B but, simultaneously, the problem went away in A and C was still not affected.  Now, the problem is in project C but not A or B.  (I'm not making this up, by the way.)  I can't figure it out.  The problem seems to jump randomly from one solution to the next.  I've made no significant changes to any of the projects, just a new page here and a new page there . . . lather, rinse and repeat.  I've searched the projects for the objects in question and they are located only in Microsoft.Practices.EnterpriseLibrary.Data and Microsoft.Practices.EnterpriseLibrary.Common dlls.  I'm not sure what to do about this or how to problem solve any further.  (Stuff like this makes me want to quit my job and go work at McDonald's!)

Dec 12 2011 at 2:25 PM

Stack Trace:

Microsoft.Practices.WizardFramework.WizardExecutionException: The wizard  failed to execute. The error was:
Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider'. ---> System.InvalidCastException: Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider'.
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeLoadingLocator.GetRegistrationsInternal(IConfigurationSource configurationSource, Func`3 registrationAccessor)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.TypeLoadingLocator.GetRegistrations(IConfigurationSource configurationSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<GetRegistrations>b__0(ITypeRegistrationsProvider l, IConfigurationSource cs)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<>c__DisplayClass5.<GetRegistrationsInternal>b__4(ITypeRegistrationsProvider l)
   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.RegisterAllCore(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ChangeTrackingContainerConfigurator.RegisterAll(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(ITypeRegistrationsProvider locator, IContainerConfigurator configurator, IConfigurationSource configSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(IContainerConfigurator configurator, IConfigurationSource configSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity.EnterpriseLibraryCoreExtension.Initialize()
   at Microsoft.Practices.Unity.UnityContainerExtension.InitializeExtension(ExtensionContext context)
   at Microsoft.Practices.Unity.UnityContainer.AddExtension(UnityContainerExtension extension)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity.EnterpriseLibraryBlockExtension.Initialize()
   at Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.Unity.ValidationBlockExtension.Initialize()
   at Microsoft.Practices.Unity.UnityContainerExtension.InitializeExtension(ExtensionContext context)
   at Microsoft.Practices.Unity.UnityContainer.AddExtension(UnityContainerExtension extension)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.AddValidationExtension()
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator..ctor(IUnityContainer container)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer(IConfigurationSource configurationSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.SetCurrentContainerIfNotSet()
   at Microsoft.Practices.EnterpriseLibrary.Validation.ValidationFactory.get_DefaultCompositeValidatorFactory()
   at Microsoft.Practices.EnterpriseLibrary.Validation.PropertyValidationFactory.GetPropertyValidatorFromAttributes(Type type, PropertyInfo propertyInfo, String ruleset, MemberAccessValidatorBuilderFactory memberAccessValidatorBuilderFactory)
   at Microsoft.Practices.EnterpriseLibrary.Validation.PropertyValidationFactory.GetPropertyValidator(Type type, PropertyInfo propertyInfo, String ruleset, ValidationSpecificationSource validationSpecificationSource, MemberAccessValidatorBuilderFactory memberAccessValidatorBuilderFactory)
   at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValidationIntegrationHelper.GetValidator()
   at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.ValidatedControlItem.get_Validator()
   at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.ValidationProvider.PerformValidation(ValidatedControlItem validatedControlItem)
   at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WinForms.ValidatedControlItem.OnValidating(Object source, CancelEventArgs e)
   at System.Windows.Forms.Control.OnValidating(CancelEventArgs e)
   at System.Windows.Forms.Control.NotifyValidating()
   at System.Windows.Forms.Control.PerformControlValidation(Boolean bulkValidation)
   at System.Windows.Forms.Control.PerformContainerValidation(ValidationConstraints validationConstraints)
   at System.Windows.Forms.ContainerControl.ValidateChildren(ValidationConstraints validationConstraints)
   at System.Windows.Forms.UserControl.ValidateChildren(ValidationConstraints validationConstraints)
   at System.Windows.Forms.UserControl.ValidateChildren()
   at Microsoft.Practices.WebClientFactory.CustomWizardPages.CreateViewPageBase._viewNameTextBox_TextChanged(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
   at System.Windows.Forms.TextBoxBase.OnTextChanged(EventArgs e)
   at System.Windows.Forms.Control.set_Text(String value)
   at System.Windows.Forms.TextBoxBase.set_Text(String value)
   at System.Windows.Forms.TextBox.set_Text(String value)
   at Microsoft.Practices.WebClientFactory.CustomWizardPages.CreateViewPageBase.ShowViewName(String viewName, String viewFileExtension)
   at Microsoft.Practices.WebClientFactory.CustomWizardPages.CreateViewPageBasePresenter.OnViewReady()
   at Microsoft.Practices.WebClientFactory.CustomWizardPages.CreateViewPageBase.InitializePresenterAndModel()
   at Microsoft.Practices.WebClientFactory.CustomWizardPages.CreateViewPageBase.OnLoad(EventArgs e)
   at System.Windows.Forms.UserControl.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Control.set_Visible(Boolean value)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at Microsoft.WizardFramework.WizardForm.Start(IWin32Window parent)
   at Microsoft.Practices.WizardFramework.WizardGatheringService.Microsoft.Practices.Common.Services.IValueGatheringService.Execute(XmlElement data, Boolean allowSuspend)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.WizardFramework.WizardGatheringService.Microsoft.Practices.Common.Services.IValueGatheringService.Execute(XmlElement data, Boolean allowSuspend)
   at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
   at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
   at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
   at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
   at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
   at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

Dec 13 2011 at 4:37 PM

Hi,

As suggested in the aforementioned threads this problem seems to be related to your solution and environment.

As far as I know, the only known approaches to fix this problem are the ones proposed in those links. Also, if those approaches are not useful to solve your problem, some users have also suggested that deleting the .gpState file of the solution, re-opening the visual studio & solution and re-enabling WCSF Guidance seems to fix this problem "temporarily." Please, create a backup of your .gpState file before trying this approach.

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Jan 18 at 5:48 PM

I've been unable to find a permanent solution to the problem but deleting the .gpState file and re-enabling WCSF Guidance is working for me.  Thanks!

May 1 at 6:21 AM

The same issue is happening for me with SCSF 2010 and deleting the .gpState and re-enabling SCSF did not work  I also get the same exception when I try to use the guidance to add a new business module.

I believe that this issue started happening once I upgraded the assemblies to the latest version of Enterprise Library (ver 5).

May 15 at 4:31 AM

Anyone?  Deleting the .gpState and re-enabling did not work for me.  I had to check out an earlier version of my code and create new modules in there and transport them into my latest version.

May 15 at 6:13 PM

Hi narimj,

The workarounds proposed in this thread are targeted to the WCSF guidance. Therefore, the details of how to solve your problem with SCSF might be different for the ones described here.

As far as I know, there have been several discussions regarding this topic; but which approach should be used often depend of each particular scenario.

I believe the following threads in the SCFS Forums might be related to your problem:

Also, you might find the following work items posted in the SCSF Issue Tracker useful:

Regards,

Damian Cherubini
http://blogs.southworks.net/dcherubini

May 17 at 11:10 PM

I understand its WCSF but its the SAME EXACT error.  I am assuming that the guidance packages share some similar code which would cause this issue in both WCSF and SCSF.  None of the links you provide are related to the issue I am experiencing.  I guess I will create a new issue in the SCSF Issue Tracker and hope someone there can shed some light on this.