CustomForms "Sequence contains more than one element" error

Topics: Core
Dec 27, 2012 at 1:45 PM

Hi,

I've got an error when trying to create custom form in Orchard 1.6:

 

An unhandled exception has occurred and the request was terminated. Please refresh the page. If the error persists, go backSequence contains more than one elementSystem.InvalidOperationException: Sequence contains more than one element at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source) at Orchard.Core.Settings.Metadata.ContentDefinitionManager.<>c__DisplayClass1.<GetTypeDefinition>b__0(AcquireContext`1 ctx) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard.Web\Core\Settings\Metadata\ContentDefinitionManager.cs:line 42 at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard\Caching\Cache.cs:line 57 at Orchard.Caching.Cache`2.AddEntry(TKey k, Func`2 acquire) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard\Caching\Cache.cs:line 27 at Orchard.Caching.Cache`2.<>c__DisplayClass2.<Get>b__0(TKey k) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard\Caching\Cache.cs:line 19 at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory) at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard\Caching\Cache.cs:line 17 at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2 acquire) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard\Caching\DefaultCacheManager.cs:line 33 at Orchard.Core.Settings.Metadata.ContentDefinitionManager.GetTypeDefinition(String name) in e:\Workspace\Moje\PersonalSiteNew\src\Orchard.Web\Core\Settings\Metadata\ContentDefinitionManager.cs:line 40 at Orchard.ContentTypes.Services.ContentDefinitionService.GetType(String name) at Orchard.ContentTypes.Controllers.AdminController.Edit(String id) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWithFilters>b__10() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)

 

Probably this error is caused by double CustomForm content type - I see double CustomForm item on a list of content types in orchard admin panel. Do you know how to solve this problem? 

Dec 27, 2012 at 2:36 PM
Edited Dec 27, 2012 at 2:37 PM

Of course I couldn't delete one of Custom Form content type from admin panel, because of the same error, but I managed to do it by manually deleting rows in db in Settings_ContentTypeDefinitionRecord and Settings_ContentPartDefinitionRecord tables. Problem solved :)