Copied to clipboard

Flag this post as spam?

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


  • Anton Oosthuizen 192 posts 470 karma points
    Feb 27, 2013 @ 05:55
    Anton Oosthuizen
    0

    Contour Index was outside the bounds of the array.

    Hi im using umbraco 6 with contour 3 and I am getting an Index out of range error. An cant access the website at all.

    Stack trace

    [IndexOutOfRangeException: Index was outside the bounds of the array.]
       Umbraco.Forms.CodeFirst.FormManager.<SynchronizeForm>b__22(String x) in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\FormBuilder\FormManager.cs:389
       System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +250
       System.Linq.Enumerable.ToDictionary(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector) +90
       Umbraco.Forms.CodeFirst.FormManager.SynchronizeForm(Type typeForm) in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\FormBuilder\FormManager.cs:389
       Umbraco.Forms.CodeFirst.FormManager.SynchronizeForms() in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\FormBuilder\FormManager.cs:201
       Umbraco.Forms.CodeFirst.FormManager.Synchronize() in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\FormBuilder\FormManager.cs:24
       Umbraco.Forms.CodeFirst.UmbracoManager.Synchronize() in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\UmbracoManager.cs:32
       Umbraco.Forms.CodeFirst.UmbracoManager.SynchronizeIfNotSynchronized() in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\UmbracoManager.cs:21
       Umbraco.Forms.CodeFirst.ContourFormBuilderHttpModule.context_BeginRequest(Object sender, EventArgs e) in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.CodeFirst\ContourFormBuilderHttpModule.cs:27
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

     

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 27, 2013 @ 10:30
    Tim Geyssens
    0

    Did you create any code first forms? 

  • Anton Oosthuizen 192 posts 470 karma points
    Feb 27, 2013 @ 10:45
    Anton Oosthuizen
    0

    Yeah I suppose it will help here it is: 

     

    using System;

    using System.Collections.Generic;

    using System.Web;

    using Umbraco.Forms.CodeFirst;

    using umbraco.cms.businesslogic.member;

    using umbraco.BusinessLogic;

    using Umbraco.Forms.Core.Providers.FieldTypes;

    using System.Web.Security;

     

    namespace Contour.CodeFirstExample

    {

     

        public enum FormPages

        {

            Registration

        }

     

        public enum FormFieldsets

        {

            Details

        }

     

        [Form("MemberCF/Registration", ShowValidationSummary = true,MessageOnSubmit = "You are now registered! Please click on activation link sent to your email to activate your membership")]

        public class Registration : FormBase

        {

            public const string MemberTypeAlias = "User-Member";

            public const string MemberGroupName = "Sinawe";

     

            [Field(FormPages.Registration, FormFieldsets.Details,

                Mandatory = true)]

            public string Name { get; set; }

            [Field(FormPages.Registration, FormFieldsets.Details,

                Mandatory = true)]

            public string Surname { get; set; }

            [Field(FormPages.Registration, FormFieldsets.Details,

                Mandatory = true,

                Regex = @"(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})")]

            public string Email { get; set; }

     

            [Field(FormPages.Registration, FormFieldsets.Details,

                Type = typeof(Password),

                Mandatory = true)]

            public string Password { get; set; }

     

            [Field(FormPages.Registration, FormFieldsets.Details,

                Type = typeof(Password),

                Mandatory = true)]

            public string RepeatPassword { get; set; }

     

            [Field(FormPages.Registration, FormFieldsets.Details,"Contact Number",

              Mandatory = true)]

            public string Contact_Number { get; set; }

            [Field(FormPages.Registration, FormFieldsets.Details,

              Mandatory = true)]

            public string Division { get; set; }

            

            

            [Field(FormPages.Registration, FormFieldsets.Details,

              Mandatory = true)]

            public string Manager { get; set; }

     

     

            //[Field(FormPages.Registration, FormFieldsets.Details,

            // Type = typeof(Umbraco.Forms.Core.Providers.FieldTypes.CheckBox))]

            //public string Newsletter { get; set; }

     

     

     

            public override IEnumerableValidate()

            {

     

                var e = new List();

     

              

                //checks if email isn't in use

               

     

     

     

                if (Member.GetMemberFromLoginName(Email) != null)

                    e.Add(new Exception("Email already in use"));

                //makes sure the passwords are identical

                if (Password != RepeatPassword)

                    e.Add(new Exception("Passwords must match"));

     

                return e;

            }

            public override void Submit()

            {

                //get a membertype by its alias

                var mt = MemberType.GetByAlias(MemberTypeAlias); //needs to be an existing membertype

                //get the user(0)

                var user = new User(0);

                //create a new member with Member.MakeNew

               

       

                var member = Member.MakeNew(Name + Surname +"("  + Email +")" , mt, user);

                //assign email, password and loginname

                member.Email = Email;

                member.Password = Password;

                member.LoginName = Email;

                //asign custom properties

                member.getProperty("firstName").Value = Name;

                member.getProperty("lastName").Value = Surname;

                member.getProperty("contactNumber").Value = Contact_Number;

                member.getProperty("division").Value = Division;

                member.getProperty("manager").Value = Manager;

                     

              

     

                //asssign a group, get the group by name, and assign its Id

                var group = MemberGroup.GetByName(MemberGroupName); //needs to be an existing MemberGroup

                member.AddGroup(group.Id);

                //generate the member xml with .XmlGenerate

                member.XmlGenerate(new System.Xml.XmlDocument());

                member.Save();

                //add the member to the website cache to log the member in

                //Member.AddMemberToCache(member);

                //var myUser = System.Web.Security.Membership.GetUser();

                //myUser.IsApproved = false;

                

                

              

            }

        }

    }

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 27, 2013 @ 10:59
    Tim Geyssens
    100

    Ok think I might have found the issue, could you try updating the codefirst assembly to the one found here http://nightly.umbraco.org/Umbraco%20Contour/3.0.8%20WIP/ (the _update archive)

    Please let me know if that fixes the issue, thanks :)

  • Anton Oosthuizen 192 posts 470 karma points
    Feb 27, 2013 @ 16:43
    Anton Oosthuizen
    0

    Shot!

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Feb 27, 2013 @ 16:48
    Tim Geyssens
    0

    Great, thanks for confirming :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies