1

Resolved

Session State Mode

description

After pulling the latest source from svn today, I found the new session state management uses non-serializable objects. This is a problem when using any session state provider other than inProc. Below is the error message & strack trace.
 
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.
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.Web.HttpException: 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.
 
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 'System.Xml.Linq.XDocument' in Assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +7736011
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +258
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +111
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +283
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +45
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +7634090
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +461
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +134
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +1577
 
[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) +1662
System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +34
System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer) +606
MySql.Web.SessionState.MySqlSessionStateStore.Serialize(SessionStateItemCollection items) +111
MySql.Web.SessionState.MySqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +173
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +560
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
 
 
Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016

file attachments

comments

efredin wrote Feb 11, 2010 at 8:45 PM

Uploaded patch 5249 - It didn't attach to this bug and I'm not sure why.

DanielSchaffer wrote Feb 12, 2010 at 4:49 AM

I've applied the patch you added and checked it in, though I'm going to do a quick test tomorrow to see if all the classes need it or just the FacebookObjectBase class.

efredin wrote Feb 16, 2010 at 3:48 PM

This didn't fix the problem. I must have had some lingering session state when my fix was successful. I'll see if I can't figure it out (since I can't push code now until it works).

DanielSchaffer wrote Feb 16, 2010 at 4:29 PM

It doesn't say anything about what class the XDocument property is in? Is this on every request or just when you're doing something specific?

efredin wrote Feb 17, 2010 at 11:20 PM

Its the XDocument property of FacebookObjectBase. It was occurring on pretty much every HTTP request made to my server, but I did manage to fix it. The server is running MySQL session state manager. The patch I uploaded previously had a path that would still allow for a serialization / null ref exceptions.

wrote Feb 17, 2010 at 11:20 PM

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:30 PM

Hi,
I am getting the searialization error in facebook connect when i tried to retrieve some information from facebook after a connect login from my site when i was using SQLServer session model
-Sekhar

sekharv wrote Apr 20, 2010 at 11:42 PM

One final comment. I am sorry for the huge number of comments. Nothing was happening when i was clicking Add Comment and i kept clicking. later when I refershed the page i realized there are so many comments.

wrote Feb 14, 2013 at 7:50 PM

wrote May 16, 2013 at 9:55 AM

wrote May 16, 2013 at 9:55 AM

wrote Jun 14, 2013 at 7:15 AM