Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Bennett 30 posts 53 karma points
    Jul 21, 2011 @ 15:50
    Paul Bennett
    0

    Error when posting comment when there is more than 1 ublogsy blog in single Umbraco installation

    I want to have multiple instances of ublogsy blogs running withing the same installation of Umbraco, E.G.

    This seems to work ok until someone posts a comment and then it throws the following error (see below) - is this a bug or have I done something incorrectly?

     

    Server Error in '/' Application.

    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:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [InvalidOperationException: Sequence contains more than one element]
       System.Linq.Enumerable.Single(IEnumerable`1 source) +690
       uBlogsy.Web.usercontrols.uBlogsy.Contact.GetAutoApprove(DynamicNode d) in D:\_PROJECTS\uBlogsy\Branches\1.32_bugs_search\uBlogsy\uBlogsy\usercontrols\uBlogsy\Contact.ascx.cs:130
       uBlogsy.Web.usercontrols.uBlogsy.Contact.CreateComment() in D:\_PROJECTS\uBlogsy\Branches\1.32_bugs_search\uBlogsy\uBlogsy\usercontrols\uBlogsy\Contact.ascx.cs:114
       uBlogsy.Web.usercontrols.uBlogsy.Contact.btnSubmit_Click(Object sender, EventArgs e) in D:\_PROJECTS\uBlogsy\Branches\1.32_bugs_search\uBlogsy\uBlogsy\usercontrols\uBlogsy\Contact.ascx.cs:60
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jul 21, 2011 @ 22:19
    Anthony Dang
    0

    Hey Paul

    Thanks for the bug report. 

    After looking at your content tree I immeditely see that is one case that I have not taken care of.

    I assumed that the blog would be at leve 1 in the tree. So you'll notice AncestorsOrSelf(1),Descendants("uBlogsyLanding").

    I've fixed the contact control in version 1.33. Now it calls AncestorsOrSelf("uBlogsyLanding"). It shouldnt crash now.

     

     

     

  • Paul Bennett 30 posts 53 karma points
    Jul 25, 2011 @ 12:29
    Paul Bennett
    0

    Hi Anthony - thanks for sorting that out - it works a treat!

    I just noticed also however that the dashboard comment approval tab only lists out items from one of the blogs not both of them. I guess this is similar issues? Not to worry though, I don't currently need that functionality for this project.

    Cheers, Paul

  • Abrar Sair 1 post 21 karma points
    Jul 26, 2011 @ 09:59
    Abrar Sair
    0

    hi!

    i am also facing the same problem. i dont have multiple blogs but i have changed the hierarchy of my site so that blog is not the landing page of my page.

     

    when i try to post comments following error shows!

    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: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace: 

    [InvalidOperationException: Sequence contains more than one element]
       System.Linq.Enumerable.Single(IEnumerable`1 source) +2718217
       uBlogsy.Web.usercontrols.uBlogsy.Contact.GetAutoApprove(DynamicNode d) in D:\_PROJECTS\uBlogsy\Branches\1.32_bugs_search\uBlogsy\uBlogsy\usercontrols\uBlogsy\Contact.ascx.cs:130
       uBlogsy.Web.usercontrols.uBlogsy.Contact.CreateComment() in D:\_PROJECTS\uBlogsy\Branches\1.32_bugs_search\uBlogsy\uBlogsy\usercontrols\uBlogsy\Contact.ascx.cs:114
       uBlogsy.Web.usercontrols.uBlogsy.Contact.btnSubmit_Click(Object sender, EventArgs e) in D:\_PROJECTS\uBlogsy\Branches\1.32_bugs_search\uBlogsy\uBlogsy\usercontrols\uBlogsy\Contact.ascx.cs:60
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
       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

     

    one more thing i want to know  that as you mentioned above that you have fixed the bug in the new version. i have made changes in the master templates. so what if i update my package. will my changes will be disgaurded??

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jul 26, 2011 @ 22:09
    Anthony Dang
    0

     

    Interesting...

     

    Here is the code for v1.32. It has a .Single().

    I'm not sure why this breaks for you but v1.33 has been changed to look up the tree, rather than going to level 1 and looking down (see 2nd code snippet).

    Try getting v1.33. The only change was this fix.

     

     

    v1.32

            private bool GetAutoApprove(DynamicNode d)
            {
                var root = d.AncestorOrSelf(1).DescendantsOrSelf("uBlogsyLanding").Items.Single();
                return root.GetProperty("uBlogsySpamAutoApproveComments").Value == "1" ? true : false;
            }

     

     

    Same method in v1.33:

            private bool GetAutoApprove(DynamicNode d)
            {
                var root = d.AncestorOrSelf("uBlogsyLanding");
                return root.GetProperty("uBlogsySpamAutoApproveComments").Value == "1" ? true : false;
            }
Please Sign in or register to post replies

Write your reply to:

Draft