Workflow Serialization issue on web farm with version 1.7.1

Topics: Administration
Oct 24, 2013 at 5:42 PM
We are experiencing the following issue on an implementation running version 1.7.1 on a web farm with the Workflow module. We use SQL server to manage state on the farm. When editing workflow item by selecting activity through Dashboard and selecting save the following error occurs:

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
Stack Trace: 


[SerializationException: Type 'Orchard.Workflows.ViewModels.UpdatedActivityModel' in Assembly 'Orchard.Workflows, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]
   System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +12476719
   System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +361
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +420
   System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +976
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +969
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Object data) +516
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo) +1050
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +534
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +1016
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +319
   System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +1559

[HttpException (0x80004005): Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.]
   System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +2243715
   System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +49
   System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer) +811
   System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData item, Stream stream) +342
   System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte[]& buf, Int32& length, Boolean compressionEnabled) +99
   System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +3673384
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +929
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
Developer
Oct 26, 2013 at 9:18 AM
Interesting. An instance of UpdateActivityModel is being stored in TempData, which by default uses SessionState. Which in your scenario is a problem, unless we either mark the viewmodels as serializable, or come up with a different solution than using TempData.
Could you please file a bug via Issues on CodePlex? Thanks.
Oct 26, 2013 at 2:55 PM
Thanks Sipke,

Was logged on Workitem 20235 which was in fact a duplicate of WorkItem 20024.

I see Sebastien fixed this on Friday.

Thanks Sebastien.