Broken site after 4.2 SP1 upgrade

Posted by Community Admin on 04-Aug-2018 11:07

Broken site after 4.2 SP1 upgrade

All Replies

Posted by Community Admin on 05-Oct-2011 00:00

Hi,

After having upgrading to 4.2 SP1, I get this error when trying to publish a news item:

Culture is not supported.
Parameter name: name
n is an invalid culture identifier

This is with a bilingual site. I upgraded another site which is monolingual, and I didn't get this problem.

Can anyone help?

Thanks.

Posted by Community Admin on 05-Oct-2011 00:00

My colleague thinks this could be due to our custom fields.

This is what fields look like in the database, in the sf_news_items table:

(...)     
      ,[links]
      ,[liens]
      ,[f_r__docs]
      ,[f_r__contacts]
      ,[e_n__docs]
      ,[e_n__contact]
      ,[f_r__images]
      ,[e_n__images]

Could that explain why it's looking for the "n" Culture, because of the underscores or something? It seems like it should get the "en" or "en-something" culture instead, rather than just "n".
And this bug only seems to affect content which has custom fields.

By the way, this problem is very urgent for us, so we've opened a support ticket too. This is a show stopper, while we're supposed to ship our site next week.

Posted by Community Admin on 06-Oct-2011 00:00

We've made some progress (or possibly fixed the problem, but I don't want to rejoice too early).
More info:

- Most of our content was automatically imported with a little program we developed, which uses the Sitefinity API
- Only some of the imported content was corrupt, newly-created content works fine
- Only English imported content causes errors (FR-only content is fine, EN-only content crashes, and FR/EN content crashes)
- When looking into the database, table "sf_news_tems", we noticed (among other things) that imported English content has the "approval_workflow_state_" column set to NULL, while content which works fine has this column set to 'Published'
- Taking a random non-working English news item, I manually updated its "approval_workflow_state_" column to 'Published', and now this news item seems to work fine in the back end!

To fix this in our import program, we added the 2nd line:

manager.Lifecycle.PublishWithSpecificDate(sfEvents, ntArticle.PublishedDate, cultLang);
sfEvents.ApprovalWorkflowState = "Published";

So this seems like a bug in the Sitefinity API, which sometimes does not set the ApprovalWorkflowState property to "Published" despite having called the PublishWithSpecificDate method.

Posted by Community Admin on 07-Oct-2011 00:00

Hi Thomas,

Approval workflow records are initialized only when the items goes through the standard workflow. Currently your publishing it through the API, which is not executing the workflow. Please try this code:

/// <summary>
        /// Creates a default approval tracking record for the specified item with the corresponding approval tracking records map
        /// </summary>
        /// <param name="workflowItem">Item</param>
        /// <param name="applicationName">Application name</param>
        /// <param name="status">Status to set to the item</param>
        public static void InitializeApprovalTrackingRecordMap(this IApprovalWorkflowItem workflowItem, string applicationName, string status = "Published")
       
            if (workflowItem.ApprovalTrackingRecordMap == null)
           
                var approvalTrackingMap = new ApprovalTrackingRecordMap() Id = Guid.NewGuid() ;
                workflowItem.ApprovalTrackingRecordMap = approvalTrackingMap;
           
            var trackingRecord = CreateApprovalTrackingRecord(workflowItem.Id, applicationName, status);

            workflowItem.ApprovalTrackingRecordMap.ApprovalRecords.Add(trackingRecord);
            workflowItem.ApprovalWorkflowState = status;
       

        /// <summary>
        /// Creates an approval tracking record for the specified item id
        /// </summary>
        /// <param name="workflowItemId">Item</param>
        /// <param name="applicationName">Application name</param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static ApprovalTrackingRecord CreateApprovalTrackingRecord(Guid workflowItemId, string applicationName, string status)
       
            var culture = CultureInfo.CurrentUICulture;
            var invariant = CultureInfo.InvariantCulture.LCID;
            var cultureId = culture.LCID;
            var multilingual = AppSettings.CurrentSettings.Multilingual;
            if (multilingual)
           
                if (cultureId == AppSettings.CurrentSettings.DefaultFrontendLanguage.LCID)
               
                    cultureId = invariant;
               
           

            var trackingRecord = new ApprovalTrackingRecord()
           
                ApplicationName = applicationName,
                Culture = multilingual ? cultureId : invariant,
                DateCreated = DateTime.Now,
                Id = Guid.NewGuid(),
                LastModified = DateTime.Now,
                Note = string.Empty,
                Status = status,
                UserId = SecurityManager.CurrentUserId,
                WorkflowItemId = workflowItemId
            ;

            return trackingRecord;
       


Please run this before you call the publish method. The application name could be found in the provider: manager.Provider.ApplicationName.

So it should be something like that in your case:

sfEvents.InitializeApprovalTrackingRecordMap(manager.Provider.ApplicationName);
manager.Lifecycle.PublishWithSpecificDate(sfEvents, ntArticle.PublishedDate, cultLang);


Greetings,
Pavel Iliev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed