SessionState problem after upgrading

Found in

EPiServer.ConnectForMarketingAutomation 5.3.0

Fixed in

EPiServer.ConnectForMarketingAutomation 5.3.3

Created

Mar 18, 2019

Updated

Mar 22, 2019

State

Closed, Fixed and tested


Description

Partner reports they get the exception below - after submitting a form (EPiServer.Forms.Implementation.Elements.FormContainerBlock) on a page and the page is reloaded when the site uses SQL Server SessionState:
<sessionState mode="SQLServer" sqlConnectionString="..." cookieless="false" timeout="720" />

See comments for more information

[SerializationException: Type 'Episerver.Marketing.Connector.Framework.Data.EntityProfile' in Assembly 'Episerver.Marketing.Connector, Version=5.3.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +965
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +83
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +238
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +194
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +711
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +91
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +751
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +217
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +2117

[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) +2274
System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +50
System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer) +758
System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData item, Stream stream) +291
System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte[]& buf, Int32& length, Boolean compressionEnabled) +80
System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +731
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +832
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +194
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +91