Problem upgrading to new version. Index was outside the bounds of the array.

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

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.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
2/15/2015 12:20:48 PM
Gravatar
Total Posts 18

Problem upgrading to new version. Index was outside the bounds of the array.

When I try to run Setup, I get this error after SQL upgrade did fine:

Welcome to mojoPortal Setup

Probing system...
File system permissions ok.
MSSQL database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema is up to date.
1 site(s) found.
Configuring feature Html Content - 00:00:03.7842164
An Error Occurred:Index was outside the bounds of the array.
Source:mojoPortal.Data
Stack Trace at mojoPortal.Data.SqlParameterHelper.DefineSqlParameter(String paramName, SqlDbType type, String typeName, Int32 size, Byte precision, ParameterDirection dir, Object value, Boolean sizeProvided, Boolean precisionProvided) at mojoPortal.Data.DBModuleDefinition.UpdateModuleDefinitionSetting(Guid featureGuid, Int32 moduleDefId, String resourceFile, String groupName, String settingName, String settingValue, String controlType, String regexValidationExpression, String controlSrc, String helpKey, Int32 sortOrder) at mojoPortal.Business.ModuleDefinition.UpdateModuleDefinitionSetting(Guid featureGuid, Int32 moduleDefId, String resourceFile, String groupName, String settingName, String settingValue, String controlType, String regexValidationExpression, String controlSrc, String helpKey, Int32 sortOrder) at mojoPortal.Web.UI.Pages.SetupHome.SetupFeature(ContentFeature feature) at mojoPortal.Web.UI.Pages.SetupHome.SetupFeatures(String applicationName) at mojoPortal.Web.UI.Pages.SetupHome.RunSetup() at mojoPortal.Web.UI.Pages.SetupHome.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I use MSSQL 2008, Windows 7 (as test platform before real upgrade). I use

mojoportal-2-4-0-3-mssql-net35-deploymentfiles - because this is last 3.5 version.

 

 

2/17/2015 2:37:22 AM
Gravatar
Total Posts 18

Re: Problem upgrading to new version. Index was outside the bounds of the array.

Any hint, what could be the problem and what could I check would be appriciated.

2/18/2015 12:22:19 PM
Gravatar
Total Posts 1188
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Problem upgrading to new version. Index was outside the bounds of the array.

This will be a difficult error to troubleshoot, since .NET 3.5 is officially deprecated now. Are you limited by your hosting to .NET 3.5? If there's any way for you to do it, for security and compatibility I recommend moving to the latest version of mojoPortal and .NET 4.5.

Sorry I can't help you further with this particular error, but I don't have a .NET 3.5 environment to test in, nor the source code for 2.4.0.3.

Jamie

2/18/2015 1:04:32 PM
Gravatar
Total Posts 18

Re: Problem upgrading to new version. Index was outside the bounds of the array.

Currently I am limited with 2.0 (another app uses 2.0). I did send question to support, if I could have 4.5 and 2.0 on 2 different virtual folders.

 

2/18/2015 1:45:59 PM
Gravatar
Total Posts 18444

Re: Problem upgrading to new version. Index was outside the bounds of the array.

The procedure where the error happened has not changed in a long time but the error indicates a mismatch in the number of parameters from code vs those that exist in the stored procedure.

if I knew what version you started with I might be able to help resolve the error next week when I get home from vacation

2/18/2015 2:03:45 PM
Gravatar
Total Posts 18

Re: Problem upgrading to new version. Index was outside the bounds of the array.

I did start from

2.3.5.1 MSSQL

I did have to manually add identity on ID column in mp_SchemaScriptHistory table - before database upgrade did not work.

I am programmer, so I can provide you with data, that you would need (store procedure definitions ...), that we could find the root problem of this.

2/23/2015 8:17:53 AM
Gravatar
Total Posts 18

Re: Problem upgrading to new version. Index was outside the bounds of the array.

Is there any additional information, that you need and I could provide?

2/23/2015 9:01:51 AM
Gravatar
Total Posts 18444

Re: Problem upgrading to new version. Index was outside the bounds of the array.

"I did have to manually add identity on ID column in mp_SchemaScriptHistory table - before database upgrade did not work."

That tells me you did something wrong. You tried to make a backup of the database by importing objects into a new database, that does not work. It results in losing all the primary keys, foreign keys, indexes, and default values, which will cause many errors.

My conclusion is your database is in an unknown state that is not correct for the version of the code.

your error happened at

mojoPortal.Data.DBModuleDefinition.UpdateModuleDefinitionSetting

which calls the stored procedure mp_ModuleDefinitionSettings_Update

which should look like this:

ALTER PROCEDURE [dbo].[mp_ModuleDefinitionSettings_Update]

@ModuleDefID              int,
@SettingName           nvarchar(50),
@SettingValue              nvarchar(max),
@ControlType               nvarchar(50),
@RegexValidationExpression     nvarchar(max),
@FeatureGuid uniqueidentifier,
@ResourceFile nvarchar(255),
@ControlSrc    nvarchar(255),
@HelpKey    nvarchar(255),
@SortOrder    int,
@GroupName nvarchar(255)

AS

IF NOT EXISTS (
    SELECT 
        * 
    FROM 
        mp_ModuleDefinitionSettings 
    WHERE 
        (ModuleDefID = @ModuleDefID OR FeatureGuid = @FeatureGuid)
      AND
        SettingName = @SettingName
)
INSERT INTO mp_ModuleDefinitionSettings (
    FeatureGuid,
    ModuleDefID,
    ResourceFile,
    SettingName,
    SettingValue,
    ControlType,
    RegexValidationExpression,
    ControlSrc,
    HelpKey,
    SortOrder,
    GroupName

VALUES (
    @FeatureGuid,
    @ModuleDefID,
    @ResourceFile,
    @SettingName,
    @SettingValue,
    @ControlType,
    @RegexValidationExpression,
    @ControlSrc,
    @HelpKey,
    @SortOrder,
    @GroupName
)
ELSE
UPDATE
    mp_ModuleDefinitionSettings

SET
    FeatureGuid = @FeatureGuid,
    SettingValue = @SettingValue,
    ControlType = @ControlType,
    RegexValidationExpression = @RegexValidationExpression,
    ResourceFile = @ResourceFile,
    ControlSrc = @ControlSrc,
    HelpKey = @HelpKey,
    SortOrder = @SortOrder,
    GroupName = @GroupName

WHERE
    (ModuleDefID = @ModuleDefID OR FeatureGuid = @FeatureGuid)
  AND
    SettingName = @SettingName

 

GO

2/23/2015 3:47:13 PM
Gravatar
Total Posts 18

Re: Problem upgrading to new version. Index was outside the bounds of the array.

The alter procedure did help do go ahead.

I did have to add identity to

mp_ModuleDefinitionSettings

and

mp_ModuleDefinitions

After that setup completes. I run web page, but I do get page without CSS. I did check and I have skins in

/Data/skins

and in

/Data/Sites/1/skins

What is the problem?

 

2/23/2015 5:12:10 PM
Gravatar
Total Posts 1188
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Problem upgrading to new version. Index was outside the bounds of the array.

As Joe said, if you are having to add identity fields to tables, that means you have already lost the original identity fields and the critical relationships between tables.

There is no point trying to continue forward from where you are now. The only way you can fully recover your site is to go back to a complete backup of your original site, restore that backup, and start over. Exporting/importing table data from one place to another won't work, since by doing that you lose the identity fields and table relationships.

This is fully documented in Moving an Installation of mojoPortal to a Different Server.

Jamie

2/24/2015 1:27:41 AM
Gravatar
Total Posts 18

Re: Problem upgrading to new version. Index was outside the bounds of the array.

Currently original site is working. I did create backup and restore backup to new database, not copy tables. Then I did unpackage CMS to my home server and connect it to that restored database. As I did write before, setup did run through and problem is just with skins - I did get data from database and pictures from site.

I will look at link, that you did post, so, that I will see if I did miss something.

Alternative would be - is there any option to export data and import it into new installation?

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