System.IndexOutOfRangeException: MemberCount

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
4/17/2013 12:50:15 PM
Gravatar
Total Posts 18439

Re: System.IndexOutOfRangeException: MemberCount

That error does not exist in the latest version, so I do not see how it could happen after upgrading unless you did not run the setup page or did not upload all of the new files. Nothing about making a new site would solve this error, if that error happens you would get the same error with a new site.

Upgrading does not lose any data but I would backup everything first.

4/18/2013 6:12:34 AM
Gravatar
Total Posts 13

Re: System.IndexOutOfRangeException: MemberCount

Thanks Joe, well after digging through and debugging using the source code i was able to pinpoint where the problem is.

Parameter count for [mp_Users_SelectByLoginName] didn't match. For some reason it was not updated. I added (@AllowEmailFallback bit) and it works now. 

Thanks again. :)

 

12/25/2013 3:25:04 PM
Gravatar
Total Posts 4

Re: System.IndexOutOfRangeException: Add user error

Hi Joe,

 

I am getting this error.


When i tried to add user, i got the index out of range exception error. How can i fix this? As per the other user's suggestion i have looked at the stored proc and i didnt see the missing parameter like he had mentioned

ALTER PROCEDURE [dbo].[mp_Users_SelectByLoginName]

    
@SiteID    int,
@LoginName         nvarchar(50),
@AllowEmailFallback bit

The actual error

 

Index was outside the bounds of the array.

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.IndexOutOfRangeException: Index was outside the bounds of the array.

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: 
 

[IndexOutOfRangeException: Index was outside the bounds of the array.] mojoPortal.Data.SqlParameterHelper.DefineSqlParameter(String paramName, SqlDbType type, String typeName, Int32 size, Byte precision, ParameterDirection dir, Object value, Boolean sizeProvided, Boolean precisionProvided) +565 mojoPortal.Data.DBSiteUser.AddUser(Guid siteGuid, Int32 siteId, String fullName, String loginName, String email, String password, String passwordSalt, Guid userGuid, DateTime dateCreated, Boolean mustChangePwd, String firstName, String lastName, String timeZoneId) +1371 mojoPortal.Business.SiteUser.Create() +549 mojoPortal.Web.AdminUI.ManageUsers.CreateUser() +1289 mojoPortal.Web.AdminUI.ManageUsers.btnUpdate_Click(Object sender, EventArgs e) +257 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

 

Version

mojoPortal Version 2.3.9.3 MSSQL
Operating System Microsoft Windows NT 6.1.7601 Service Pack 1
ASP.NET Info v4.0.30319 Running in Full Trust

 

12/25/2013 3:37:52 PM
Gravatar
Total Posts 4

Re: System.IndexOutOfRangeException: MemberCount

Looks like last parameter timeZoneId is missing in the stored procedure 

ALTER Procedure [dbo].[mp_Users_Insert]

/*
Author:            Joe Audette
Created:        2004-09-30
Last Modified:    2011-12-29

*/

@SiteGuid    uniqueidentifier,
@SiteID    int,
@Name         nvarchar(100),
@LoginName    nvarchar(50),
@Email        nvarchar(100),
@Password     nvarchar(1000),
@PasswordSalt nvarchar(128),
@UserGuid    uniqueidentifier,
@DateCreated datetime,
@MustChangePwd bit,
@FirstName         nvarchar(100),
@LastName         nvarchar(100)

12/26/2013 1:11:17 PM
Gravatar
Total Posts 18439

Re: System.IndexOutOfRangeException: MemberCount

all I can suggest is upgrade to the latest version or modify the stored procedure

12/26/2013 1:20:15 PM
Gravatar
Total Posts 4

Re: System.IndexOutOfRangeException: MemberCount

I did modify the stored procedure but still same error.

 

ALTER Procedure [dbo].[mp_Users_Insert]

/*
Author:            Joe Audette
Created:        2004-09-30
Last Modified:    2011-12-29

*/

@SiteGuid    uniqueidentifier,
@SiteID    int,
@Name         nvarchar(100),
@LoginName    nvarchar(50),
@Email        nvarchar(100),
@Password     nvarchar(1000),
@PasswordSalt nvarchar(128),
@UserGuid    uniqueidentifier,
@DateCreated datetime,
@MustChangePwd bit,
@FirstName         nvarchar(100),
@LastName         nvarchar(100),
@TimeZoneId         nvarchar(32),
@EmailChangeGuid    uniqueidentifier


AS
INSERT INTO         [dbo].mp_Users
(
        SiteGuid,
            SiteID,
                [Name],
            LoginName,
                Email,
                [Pwd],
            UserGuid,
            DateCreated,
            TotalRevenue,
            MustChangePwd,
            RolesChanged,
            FirstName,
            LastName,
            TimeZoneId,
            EmailChangeGuid,
            PasswordResetGuid,
            PasswordSalt
    

)

VALUES
(
            @SiteGuid,
            @SiteID,
                @Name,
            @LoginName,
                @Email,
                @Password,
            @UserGuid,
            @DateCreated,
            0,
            @MustChangePwd,
            0,
            @FirstName,
            @LastName,
            @TimeZoneId,
            @EmailChangeGuid,
            '00000000-0000-0000-0000-000000000000',
            @PasswordSalt
)

SELECT        @@Identity As UserID

12/26/2013 1:28:22 PM
Gravatar
Total Posts 18439

Re: System.IndexOutOfRangeException: MemberCount

then upgrading would be best.

It seems weird that you are using version 2.3.9.3, I don't remember any problem like this in that version and since it is an old version I would only expect to see that version for a site that has been online for a long time (ie no reason to use an old version if setting up a new site), and such a problem would have been noticed before if the site has been online a while, it would not start happening suddenly after it was previously working correctly. 

 

12/26/2013 1:33:15 PM
Gravatar
Total Posts 4

Re: System.IndexOutOfRangeException: MemberCount

I was on a older version and i did upgrade... may be something wrong happened. I will try to upgrade it. Thanks.

12/26/2013 1:38:38 PM
Gravatar
Total Posts 18439

Re: System.IndexOutOfRangeException: MemberCount

when you upgrade you need to visit /Setup/Default.aspx, it will run the db upgrade scripts but if you didn't upload all the files then the upgrade scripts might be missing so it can't run them.

You must sign in to post in the forums. This thread is closed to new posts.