Edit/Create product.. Sequence contains more than one element
Is this happening to anyone else?
If I try to edit a product the products module throws an error on the following call followed by an alert in the editor that says Sequence contains more than one element. The system then sends me back to the list
public void Copy(ProductItem source, ProductItem destination)
this.Provider.CopyContent(source, destination);
private string GetTaxonomyProvider(PropertyDescriptor property) if (property == null) throw new ArgumentNullException("property"); MetaType metaType = this.metadataManager.GetMetaType(base.DataItem.GetType()); if (metaType == null) throw new InvalidOperationException("Organizers can be used only with types that are metatypes."); MetaField field = metaType.Fields.Where<MetaField>(delegate (MetaField f) return (f.FieldName == property.Name); ).SingleOrDefault<MetaField>(); //<-- BOOM |
So has no one else has run into this? I'm getting it when i try to use the
edit/create from the backend or when I try to do create or edit with
code
here's a stack trace from the call through code
Sequence contains more than one element
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Sequence contains more than one element
Source Error:
Line 328: public ProductItem Publish(ProductItem item) Line 329: Line 330: return this.Provider.Publish(item, this.Copy, this.GetProducts()); Line 331: Line 332: |
Source File: C:\CheckedOutRepos\MyNameSpace.svn.pond.lf\trunk\MyNameSpace.Products\Data\ProductsManager.cs Line: 330
Stack Trace:
[InvalidOperationException: Sequence contains more than one element] DynamicModule.ns.Wrapped_OpenAccessProvider_0e6502b235d640bf88327bfc3b19ed00.ExecuteOnPublish(TContent masterItem, Action`2 copy, TContent liveItem) +281 Telerik.Sitefinity.Modules.GenericContent.ContentDataProviderBase.Publish(TContent masterItem, Action`2 copy, IQueryable`1 itemsQuery) +757 MyNameSpace.Products.Data.ProductsManager.Publish(ProductItem item) in C:\CheckedOutRepos\MyNameSpace.svn.pond.lf\trunk\MyNameSpace.Products\Data\ProductsManager.cs:330 SitefinityWebApp.Models.ProductRepository.CreateProduct(ProductModel product) in C:\CheckedOutRepos\MyNameSpace.svn.pond.lf\trunk\TRH_WebProject\Models\ProductRepository.cs:62 SitefinityWebApp.controls.ProductsUpdater.gvFCIProducts_RowCommand(Object sender, GridViewCommandEventArgs e) in C:\CheckedOutRepos\MyNameSpace.svn.pond.lf\trunk\TRH_WebProject\controls\ProductsUpdater.ascx.cs:80 System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e) +115 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +68 System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +121 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 |
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225
Dear Drew
I get an Sequence contains more than one element simply by trying to reorder pages in the backend! This is when I use Chrome 11. When I use FF 4 - no error message but same effect - reodering does not work.
I now this is no help to you but maybe sometimes it helps when debugin to look a bit further then what you are working on right now. It might be simply a bug somewhere else - the CMS.
Markus
Thanks for the reply Markus. It was definitely a problem with the custom taxonomy for me. It somehow got duplicated in the backend.
I put in a support ticket and it basically boiled down to running this bit of code to delete the duplicate entry from the database
var fluent = App.WorkWith();
var broken = fluent.DynamicData().Type(
typeof
(ProductItem)).Fields().Where(f => f.FieldName ==
"MyTaxonomyName"
).Get().First();
fluent.DynamicData().Type(
typeof
(ProductItem)).Field(broken).Delete().SaveChanges(
true
);