Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Server error when switching mode to ReadOnlyMode

Found in

EPiServer.Forms 4.4.0

Fixed in

EPiServer.Forms 4.6.1

(Or a related package)

Created

Jan 23, 2017

Updated

Sep 26, 2017

Area

Core

State

Closed, Fixed and tested


Description

SourceTree.lnk Note: This bug does not have exact steps to reproduce. Its happens sometimes.

1. Configure read-only mode for your site by adding this code under appsettings
<add key="episerver:DatabaseMode" value="ReadOnly" />.
2. Go to Edit View > create or edit any form.
3. Do anything on the form => The site notifies you of read-only mode.
4. Edit the web.config file and remove the added configuration.
5. Refresh the browser.

Issue: (this issue only happens occasionally)

Server Error in '/' Application.
 
An item with the same key has already been added.
Exception Details: System.ArgumentException: An item with the same key has already been added.
Stack Trace: 
 
[ArgumentException: An item with the same key has already been added.]
   System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +56
   System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +14287305
   EPiServer.Forms.Helpers.Internal.FormsExtensions.GetDerivedTypes(Type baseType, Boolean isCached) +978
   EPiServer.Forms.EditView.FormsModuleViewModel.get_AllowedPreviewableTextBoxTypes() +102
   GetAllowedPreviewableTextBoxTypes(Object ) +125
   Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target) +114
 
[JsonSerializationException: Error getting value from 'AllowedPreviewableTextBoxTypes' on 'EPiServer.Forms.EditView.FormsModuleViewModel'.]
   Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target) +274
   Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue) +205
   Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +1120
   Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +830
   Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +425
   Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) +1234
   EPiServer.Framework.Serialization.Json.Internal.JsonObjectSerializer.Serialize(TextWriter textWriter, Object value) +71
   EPiServer.Shell.Web.Mvc.Html.ScriptExtensions.SerializeObject(HtmlHelper html, Object value, String contentType) +253
   ASP.episerver_shell_views_shared_bootstrapper_aspx.__Render__control5(HtmlTextWriter __w, Control parameterContainer) in C:\Episerver\Feed\EPiServer\Shell\Views\Shared\Bootstrapper.aspx:58
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +263
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   ASP.episerver_shell_views_shared_sleek_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in C:\Episerver\Feed\EPiServer\Shell\Views\Shared\Sleek.Master:30
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +263
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +160
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +76
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8921