IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

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.

4/30/2025 12:04:29 PM
Gravatar
Total Posts 6

IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

We haven't upgraded for a long time. There are some vulnerabilities in the older version. We are trying to update to the latest. When we copy the files and the modified web.config to the site and navigate to /Setup/Default.aspx, it doesn't load. We are using MSSQL. The exception we are seeing seems to relate to some upgraded blog functionality. But, the scripts that upgrade the database don't run. This is the exception trace from the mp_SystemLog table:

 

 Referrer(none) useragent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 System.IndexOutOfRangeException: DraftApprovalRoles     
 at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)     
 at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)     
 at System.Data.SqlClient.SqlDataReader.get_Item(String name)     
 at mojoPortal.Business.PageSettings.LoadFromReader(IDataReader reader)     
 at mojoPortal.Business.PageSettings.GetPage(Int32 siteId, Int32 pageId)     
 at mojoPortal.Business.PageSettings..ctor(Int32 siteId, Int32 pageId)     
 at mojoPortal.Business.WebHelpers.CacheHelper.LoadPage(Int32 pageID)     
 at mojoPortal.Business.WebHelpers.CacheHelper.LoadCurrentPage()     
 at mojoPortal.Business.WebHelpers.CacheHelper.GetCurrentPage()     
 at mojoPortal.Web.SiteUtils.GetSkinName(Boolean allowPageOverride, Page page)     
 at mojoPortal.Web.Components.SkinConfigManager.ensureSkinConfig()     
 at mojoPortal.Web.Global.Application_BeginRequest(Object sender, EventArgs e)     
 at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     
 at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)     
 at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

From a quick code search, it appears DraftApprovalRoles were added in v2.3.9.7

4/30/2025 12:57:36 PM
Gravatar
Total Posts 6

Re: IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

I manually ran the update mojoportal-core config database scripts up through 2.3.9.7 and now getting a PubDateUtc IndexOutOfBounds. This looks like it was added in 2.4.0.1. I can manually run the core scripts up through that. But, why does the /Setup/Default.aspx not skip all that in order to be able to actually set things up for an upgrade?

4/30/2025 1:03:04 PM
Gravatar
Total Posts 2262

Re: IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

Hello,

This appears to be a bug created by our SkinConfig feature. What's happening is it is looking up the PageSettings to determine if the page has a skin set on it, that process is then trying to find the DraftApprovalRoles on the record but that column hasn't been added to the table yet.

All of this is happening because the SkinConfig is populated when the site starts. We might be able to change this in the upcoming release so this is skipped if you're browsing to the setup page. I'm not 100% on that right at the moment and we're literally writing the blog post for the next release (2.9.1), so I am hesitant to change that release at this point.

A workaround would be to upgrade to 2.7 and then to 2.9.0.1. SkinConfig didn't exist in 2.7 so you it will not be a problem.

Hope this helps,
Joe

4/30/2025 1:10:32 PM
Gravatar
Total Posts 6

Re: IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

I manually ran up to 2.4.0.1 to avoid the PubDateUtc. Now, the /setup/default.aspx can run. But, it terminates with the exception that the table created in the 2.3.8.6 script already exists. So, I would need to roll back to the database at my un-manually-upgraded state, upgrade to 2.7, then upgrade to 2.9. I'll see if I can do that.

4/30/2025 3:45:22 PM
Gravatar
Total Posts 6

Re: IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

I rolled things back and deployed 2.7. When I executed /Setup/Default.aspx, it successfully ran the core SQL scripts from 2.3.8.6 to 2.4.0.4. When it tried to run 2.4.0.5, I see: 

 

`System.Data.SqlClient.SqlException (0x80131904): There is already an object named 'PK_dbo.AspNetUserLogins' in the database. Could not create constraint or index. See previous errors. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at mojoPortal.Data.SqlHelper.ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, String commandText, Int32 commandTimeout, SqlParameter[] commandParameters) at mojoPortal.Data.DBPortal.DatabaseHelperRunScript(String script, String overrideConnectionInfo) at mojoPortal.Business.DatabaseHelper.RunScript(Guid applicationId, FileInfo scriptFile, String overrideConnectionInfo) ClientConnectionId:bcf0e00b-6b23-431a-91db-a9b0da03aca6 Error Number:2714,State:5,Class:16 - 00:00:20.7702122`

 

Upon investigating, it appears you are creating some new tables (mp_UserLogins and mp_UserClaims) but using key names that already exist for AspNetUserLogins and AspNetUserClaims. Is it safe to manually touch that /Setup/applications/mojoportal-core/SchemaUpgradeScripts/mssql/2.4.0.5.config with a non-conflicting name?

4/30/2025 3:56:31 PM
Gravatar
Total Posts 2262

Re: IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

The 2.4.0.5 script is the only place 'PK_dbo.AspNetUserLogins' is used. No other scripts have that name at all.

I don't know how your DB would have that name in place but you should be able to change the name in 2.4.0.5 script to whatever you want.  If you run into any other trouble, you can send us a backup of your database and site files (we shouldn't need your /data/sites folder). We'll see if we can figure out what is going on with your install. We upgrade sites quite often without a problem but occasionally run into sites that have a few issues. I've added you to our Complimentary Support group so you can get to this page to upload your backup. If you can't upload it for some reason, just let us know and we can send you a different location to upload to.

Thanks,
Joe

6/11/2025 2:11:05 PM
Gravatar
Total Posts 6

Re: IndexOutOfBounds Exception when Upgrading from 2.3.8.5 to 2.9.0.1

To close the loop, here, I had to tweak a database script for the index name. Then, we successfully upgraded to 2.7 and then right away to 2.9.