I have noticed this error pops up ever so often while setting up a Tea Commerce shop v. 2.0.1 I didn't pay to much attention to it at first, but it keeps coming back. I am not doing anything specific when it happens, just navigation the shop, not adding orders or checking out.
I can see in the tracing that it comes to SessionController right before going to the OrderService.Get() where it looks for a cached order. Maybe something is cached twice since it complains that the sequence contains more than one element?
Error Loading Razor Script (file: Navgation.Main) Sekvensen indeholder mere end ét tilsvarende element ved System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate) ved TeaCommerce.Api.Services.OrderService.Get(Int64 storeId, Guid orderId) ved TeaCommerce.Api.Web.SessionController.CheckAndMoveOrderIds(Int64 storeId) ved TeaCommerce.Api.Web.SessionController.GetCurrentOrderId(Int64 storeId) ved TeaCommerce.Umbraco.Web.TC.HasCurrentOrder(Int64 storeId) ved ASP._Page_macroScripts_website_navigation_main_cshtml.Execute() i \navigation.main.cshtml:linje 19 ved System.Web.WebPages.WebPageBase.ExecutePageHierarchy() ved System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) ved System.Web.WebPages.WebPage.ExecutePageHierarchy() ved System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) ved umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) ved umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
Thanks for the help. We are using an MSSQL server. I do add some extra data to each order line such as a pickup date as a order line custom property. But I am pretty sure I got the error before I started doing that.
Its one of those errors that are hard to pinpoint because I can't reproduce it on command and I can't put my finger on the pattern.
Hmm - it might be that - if more than one property with the same alias is added. Or maybe somehow you have an order line with the same id added twice or something else. If you can try and pinpoint what is happening and if you can recreate it everytime, then we can go ahead and debug to see if it is a bug.
Just one question. How can I add an order line with the same id twice? Wouldn't that mean that I was doing some funky custom adding to the cart and not using the Tea Commerce API?
I have uncovered some more information now :) The error occurs after I have added some items to the cart, gone through the first checkout steps, but then returned to the shop instead of going to payment page. Perhaps 10-20 minutes after doing that the error occurs. When that happens and I check my TeaCommerce cookie I have a currentPaymentProcessingOrderId with an order id. If I remove that from the cookie, then the error disappers along with the items in my cart.
Can you send us the website and DB and a walkthrough how to create the bug - with all the things to click and how long you waited :) Send to info at teacommerce.net
I can't recreate the error at my machine - both using session and cookie.
Just wanted to follow up on this "error". I haven't seen it in a week since I move to another server. Anders has also tried to reproduce it without, which leads me to believe that it might have been caused by my local server setup.
As states in your mail - it looks like this bug is still there somehow. Try and disable cookies in Tea Commerce and see if that fixes the problem. If it does - then we need to test if it has something to do with a race condition for getting the order in the Cache and it is added twice. But lets try and see if its the caching part first.
Error: Sequence contains more than one element
Hi,
I have noticed this error pops up ever so often while setting up a Tea Commerce shop v. 2.0.1 I didn't pay to much attention to it at first, but it keeps coming back. I am not doing anything specific when it happens, just navigation the shop, not adding orders or checking out.
I can see in the tracing that it comes to SessionController right before going to the OrderService.Get() where it looks for a cached order. Maybe something is cached twice since it complains that the sequence contains more than one element?
Cheers
Bjørn
Hi Bjørn
Looks like there is two order with the same id maybe or maybe some data associated with the order. Are you using SQL CE?
Kind regards
Anders
Hi Anders,
Thanks for the help. We are using an MSSQL server. I do add some extra data to each order line such as a pickup date as a order line custom property. But I am pretty sure I got the error before I started doing that.
Its one of those errors that are hard to pinpoint because I can't reproduce it on command and I can't put my finger on the pattern.
Cheers
Bjørn
Hmm - it might be that - if more than one property with the same alias is added. Or maybe somehow you have an order line with the same id added twice or something else. If you can try and pinpoint what is happening and if you can recreate it everytime, then we can go ahead and debug to see if it is a bug.
Kind regards
Anders
Hi Anders,
Thanks I will see what I can come up with.
Just one question. How can I add an order line with the same id twice? Wouldn't that mean that I was doing some funky custom adding to the cart and not using the Tea Commerce API?
Cheers
Bjørn
Hi again,
I have uncovered some more information now :) The error occurs after I have added some items to the cart, gone through the first checkout steps, but then returned to the shop instead of going to payment page. Perhaps 10-20 minutes after doing that the error occurs. When that happens and I check my TeaCommerce cookie I have a currentPaymentProcessingOrderId with an order id. If I remove that from the cookie, then the error disappers along with the items in my cart.
Cheers
Bjørn
Hi Bjørn
Can you send us the website and DB and a walkthrough how to create the bug - with all the things to click and how long you waited :)
Send to info at teacommerce.net
I can't recreate the error at my machine - both using session and cookie.
Kind regards
Anders
Hi Anders,
I have sent the files and db to the email. Thank you for taking the time to look into it.
Cheers
Bjørn
Just wanted to follow up on this "error". I haven't seen it in a week since I move to another server. Anders has also tried to reproduce it without, which leads me to believe that it might have been caused by my local server setup.
Once again thanks for the help :)
Cheers
Bjørn
Hi Bjørn
As states in your mail - it looks like this bug is still there somehow. Try and disable cookies in Tea Commerce and see if that fixes the problem. If it does - then we need to test if it has something to do with a race condition for getting the order in the Cache and it is added twice. But lets try and see if its the caching part first.
Kind regards
Anders
Hi Anders,
Right I have disabled cookies for now, and will follow the Elmah log closely to see if anything happens.
Cheers
Bjørn
Great. We must have been drunk for the beers you send us when we tried to debug things :)
Right, from now on only chocolate :)
is working on a reply...