Unable to serialize session state. Part 2

After resolving the issue yesterday ( Failed to serialize the session state ), now I come across this (on the same page).

Server error in application "/". Unable to serialize session state. In StateServer and SQLServer mode, ASP.NET will serialize session state objects, and as a result, non-serialization objects or MarshalByRef objects are not allowed. The same restriction applies if similar serialization is performed in the user session state store in the "User" mode. Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it appeared in the code.

Exception Details: System.Web.HttpException: Unable to serialize session state. In StateServer and SQLServer mode, ASP.NET will serialize session state objects, and as a result, non-serialization objects or MarshalByRef objects are not allowed. The same restriction applies if similar serialization is performed in the user session state store in the "User" mode.

Source Error:

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

Stack trace:

[Exception: 'System.Data.Linq.ChangeTracker + StandardChangeTracker' 'System.Data.Linq, Version = 4.0.0.0, Culture = , PublicKeyToken = b77a5c561934e089 ' .] System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType ) +9452985 System.Runtime.Serialization.FormatterServices.GetSerializableMembers( , StreamingContext) +247 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +160 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize( obj, ISurrogateSelector surrogateSelector, Streaming , SerObjectInfoInit serObjectInfoInit, IFormatterConverter, ObjectWriter objectWriter, SerializationBinder binder) +218 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +388 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize( graph, Header [] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +444 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize( serializationStream, , [], Boolean fCheck) +133 System.Web.Util.AltSerialization.WriteValueToStream( , BinaryWriter) +1708

[HttpException (0x80004005): . "StateServer" "SQLServer" , ASP.NET , , MarshalByRef . ' .] System.Web.Util.AltSerialization.WriteValueToStream( , BinaryWriter writer) +1793 System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert( , BinaryWriter writer) +34 System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter ) +638 System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData , ) +244 System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte [] & buf, Int32 & length, Boolean compressionEnabled) +67 System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData, Object lockId, Boolean newItem) +114 System.Web.SessionState.SessionStateModule.OnReleaseState( , EventArgs eventArgs) +807 System.Web.SessionState.SessionStateModule.OnEndRequest( , EventArgs eventArgs) +184 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep( IExecutionStep, Boolean ) +75 : Microsoft.NET Framework : 4.0.30319; ASP.NET: 4.0.30319.1

serializeble LINQ.

[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Gebruiker")]
[Serializable()]
public partial class Gebruiker { }

public partial class Gebruiker : INotifyPropertyChanging, INotifyPropertyChanged
{

    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

    private string _GebruikerID;

    private string _GebruikerVoornaam;

    private string _GebruikerNaam;

    private string _GebruikerEmail;

    private string _GebruikerWachtwoord;

    private string _GebruikerPermissies;

    //...
}
+3
1

BinaryFormatter ( ) [Serializable] ISerializable. "" . :

[field:NonSerialized]

, , ..

[field:NonSerialized]
public event EventHandler FooChanged;

, , .

IMO, . - DTO - ( ). , DTO , , .

, . DBML LINQ "", DataContractSerializer ; DataContractSerializer ; . DTO, p

- ISerializable partial class / .

( , , , BinaryFormatter, )

+4

All Articles