SaaS CMS has officially launched! Learn more now.

[CMS 9.12.2] Sometimes cannot load XForms on startup (in MVC)

Vote:
 

Hi.

Sometimes when the application starts up xforms cannot be loaded (both locally and in production in event of a application reload).

EPiServer.Web.Mvc.XForms.XFormClientValidationHelper.CreateClientValidationRules(XFormsFragment fragment, LocalizationService localizationService):69
EPiServer.Web.Mvc.XForms.XFormClientValidationHelper.CreateClientValidationRules(XForm xform, LocalizationService localizationService):68
EPiServer.Web.Mvc.Html.XFormExtensions.BeginXForm(HtmlHelper htmlHelper, XForm xForm, Object htmlAttributes, LocalizationService localizationService):40
EPiServer.Web.Mvc.Html.XFormExtensions.BeginXForm(HtmlHelper htmlHelper, XForm xForm, Object htmlAttributes):13
ASP._Page_Views_FooterCustomerServiceBlock_Index_cshtml.Execute() in d:\websites\www.mywebsite.com\Views\FooterBlock\Index.cshtml:18

The view null-checks the xform before using statement

@if (Model.CurrentBlock.NewsletterRegistrationForm != null)
    {
        Html.EditAttributes(m => m.CurrentBlock.NewsletterRegistrationForm);
        Html.ValidationSummary();
        using (Html.BeginXForm(Model.CurrentBlock.NewsletterRegistrationForm, new { Action = Model.CurrentBlock.ActionUri }))
        {
            Html.RenderXForm(Model.CurrentBlock.NewsletterRegistrationForm);
        }
    }

Seems to be somewhere within episerver.dll (EPiServer.Web.Mvc.XForms) - maybe the fragment??

public static ValidationRuleDescriptor CreateClientValidationRules(XFormsFragment fragment, LocalizationService localizationService)
{
	ModelClientValidationRuleCollection modelClientValidationRuleCollection = new ModelClientValidationRuleCollection();
	if (fragment.Required)
	{
		modelClientValidationRuleCollection.Add(new ModelClientValidationRequiredRule(XFormValidator.GetRequiredValidationMessage(fragment, localizationService)));
	}
	if (!string.IsNullOrEmpty(fragment.ValidationType))
	{
		modelClientValidationRuleCollection.Add(new XFormClientValidationRegexRule("regularExpression", XFormValidator.GetRegExValidationMessage(fragment, localizationService), DataTypes.Types[fragment.ValidationType].ToString()));
	}
	return new ValidationRuleDescriptor(fragment.ValidationReference, true, modelClientValidationRuleCollection);
}

When this happen the affected pages cannot be loaded. The solution is to restart the website in IIS.
We would like to either solve the problem or to handle the error to notify suitable person(s) to do the restart.

Any suggestions?

#179624
Edited, Jun 16, 2017 15:57
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.