1

Working with:

  • Sitecore.NET 9.0.2 (rev. 180604)
  • SXA 1.7.1
  • Azure Search
  • Sitecore Forms Extension 9.0-1.8.2 (also installed nodb package on CD)

I have created a customized save action. The form is working fine in CM but while trying to submit the form in CD, it throws 500 Error.

Server Error in '/' Application.
Type 'Feature.FormsExtensions.Fields.Hidden.HiddenViewModel' in Assembly 'Feature.FormsExtensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.Serialization.SerializationException: Type 'Feature.FormsExtensions.Fields.Hidden.HiddenViewModel' in Assembly 'Feature.FormsExtensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SerializationException: Type 'Feature.FormsExtensions.Fields.Hidden.HiddenViewModel' in Assembly 'Feature.FormsExtensions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]
   System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +14740483
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +87
   System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +223
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +188
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +263
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +496
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Object data) +605
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo) +1455
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +570
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +552
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +208
   Sitecore.SessionProvider.Redis.RedisUtility.GetBytesFromObject(Object data, Boolean compress) +345
   Sitecore.SessionProvider.Redis.RedisUtility.AppendUpdatedOrNewItemsInList(ChangeTrackingSessionStateItemCollection sessionItems, List`1 list, Boolean compress) +201
   Sitecore.SessionProvider.Redis.RedisConnectionWrapper.TryUpdateIfLockIdMatchPrepare(String sessionId, Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout, String[]& keyArgs, Object[]& valueArgs) +286
   Sitecore.SessionProvider.Redis.RedisConnectionWrapper.TryUpdateAndReleaseLockIfLockIdMatch(String sessionId, Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout) +59
   Sitecore.SessionProvider.Redis.RedisSessionStateProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +893
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +856
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +223
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91

As @BartVerdonck suggested, I have raised a bug report ticket for this issue: https://github.com/bartverdonck/Sitecore-Forms-Extensions/issues/58

Since it will take time to be resolved by @BartVerdonck, is there any workaround for this issue?

  • 1
    You can clone the repository and extend the HiddenViewModel class. Then you add the serialize attribute. Once done, you need to update the namespace to use the one you created – Hishaam Namooya Sep 22 '19 at 7:43
  • Yes, I already did that. Thanks – PSS Sep 23 '19 at 9:12
2

Converting comment to answer

You can clone the repository and extend the HiddenViewModel class. You can then add the serialize decorative attribute to the class. Then build the solution and deploy the new assembly to your bin folder.

You need to also update the namespace to use the new implementation.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.