Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Serialization Error

Reply
Thread Tools

Serialization Error

 
 
Maximus
Guest
Posts: n/a
 
      01-19-2004
Hi Everyone,

I was using Inprocess session objects, but incase of aspnet process
crashes the session objects were lost as a result I decided to shift to
out of porocess session objects. For this i had to serialize the
objects. While doing that I made the classes serializable whose objects
I store in sessions. However, when I run the application I get the
following error.






Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state
mode is 'StateServer' or 'SQLServer'.
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. Please note that non-serializable objects or MarshalByRef
objects are not permitted when session state mode is 'StateServer' or
'SQLServer'.

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: The type ASP.default_aspx in Assembly h5ahqjmx,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as
serializable.]

System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMembers(RuntimeType
type, Boolean excludeNonSerializable) +853

System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type
type, StreamingContext context) +300

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInfo()
+103

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize(Object
obj, ISurrogateSelector surrogateSelector, StreamingContext context,
SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Object
obj, ISurrogateSelector surrogateSelector, StreamingContext context,
SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Write(WriteObjectInfo
objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object
graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +738

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream
serializationStream, Object graph, Header[] headers, Boolean fCheck) +136

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Stream
serializationStream, Object graph) +13
System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
BinaryWriter writer)

[HttpException (0x80004005): Unable to serialize the session state.
Please note that non-serializable objects or MarshalByRef objects are
not permitted when session state mode is 'StateServer' or 'SQLServer'.]
System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
BinaryWriter writer)
System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter writer)

System.Web.SessionState.StateClientManager.Seriali ze(SessionStateItem
item, Stream stream)

System.Web.SessionState.OutOfProcStateClientManage r.System.Web.SessionState.IStateClientManager.Set( String
id, SessionStateItem item, Boolean inStorage)
System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source, EventArgs eventArgs)

System.Web.SyncEventExecutionStep.System.Web.HttpA pplication+IExecutionStep.Execute()
+60
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87




I'll appreciate if anybody could help me with this.

Thanks.

 
Reply With Quote
 
 
 
 
Manoj G [MVP]
Guest
Posts: n/a
 
      01-20-2004
You can serialize an object of a class if the class and all its members (the
object graph) are themselves serializable. For Session state objects they
also should not be derived from MarshalByRefObject class. Check if all the
members themselves are serializable and also that none of them are
MarshalByRefObjects. If there are any, you can mark them with a
NonSerialized attribute, so that the formatter does not serialize these
(But, ofcource the state of the object in this case will be incomplete).

--
HTH,
Manoj G [.NET MVP]
Site: http://www15.brinkster.com/manoj4dotnet
Blog: http://msmvps.com/manoj/

"Maximus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Everyone,
>
> I was using Inprocess session objects, but incase of aspnet process
> crashes the session objects were lost as a result I decided to shift to
> out of porocess session objects. For this i had to serialize the
> objects. While doing that I made the classes serializable whose objects
> I store in sessions. However, when I run the application I get the
> following error.
>
>
>
>
>
>
> Unable to serialize the session state. Please note that non-serializable
> objects or MarshalByRef objects are not permitted when session state
> mode is 'StateServer' or 'SQLServer'.
> 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. Please note that non-serializable objects or MarshalByRef
> objects are not permitted when session state mode is 'StateServer' or
> 'SQLServer'.
>
> 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: The type ASP.default_aspx in Assembly h5ahqjmx,
> Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as
> serializable.]
>
>

System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMember
s(RuntimeType
> type, Boolean excludeNonSerializable) +853
>
> System.Runtime.Serialization.FormatterServices.Get SerializableMembers(Type
> type, StreamingContext context) +300
>
>

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInf
o()
> +103
>
>

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize
(Object
> obj, ISurrogateSelector surrogateSelector, StreamingContext context,
> SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493
>
>

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Obj
ect
> obj, ISurrogateSelector surrogateSelector, StreamingContext context,
> SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48
>
>

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Write(WriteObjec
tInfo
> objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515
>
>

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object
> graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +738
>
>

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Str
eam
> serializationStream, Object graph, Header[] headers, Boolean fCheck) +136
>
>

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Str
eam
> serializationStream, Object graph) +13
> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
> BinaryWriter writer)
>
> [HttpException (0x80004005): Unable to serialize the session state.
> Please note that non-serializable objects or MarshalByRef objects are
> not permitted when session state mode is 'StateServer' or 'SQLServer'.]
> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
> BinaryWriter writer)
> System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter

writer)
>
> System.Web.SessionState.StateClientManager.Seriali ze(SessionStateItem
> item, Stream stream)
>
>

System.Web.SessionState.OutOfProcStateClientManage r.System.Web.SessionState.
IStateClientManager.Set(String
> id, SessionStateItem item, Boolean inStorage)
> System.Web.SessionState.SessionStateModule.OnRelea seState(Object
> source, EventArgs eventArgs)
>
>

System.Web.SyncEventExecutionStep.System.Web.HttpA pplication+IExecutionStep.
Execute()
> +60
> System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
> completedSynchronously) +87
>
>
>
>
> I'll appreciate if anybody could help me with this.
>
> Thanks.
>



 
Reply With Quote
 
 
 
 
Maximus
Guest
Posts: n/a
 
      01-26-2004
Hi Manoj,

Thanks for the reply, I tried that and have marked all the objects which
I could. In most cases it would tell me which object it could not
serialize. But here it is saying it cannot serialize 'ASP.default_aspx
in Assembly 9iq31h5o'.
What I dont understand is why is it trying to serialize the default.aspx
page and also where is this assmebly Assembly 9iq31h5o created.

Any help will be appreciated.



Manoj G [MVP] wrote:

> You can serialize an object of a class if the class and all its members (the
> object graph) are themselves serializable. For Session state objects they
> also should not be derived from MarshalByRefObject class. Check if all the
> members themselves are serializable and also that none of them are
> MarshalByRefObjects. If there are any, you can mark them with a
> NonSerialized attribute, so that the formatter does not serialize these
> (But, ofcource the state of the object in this case will be incomplete).
>
> --
> HTH,
> Manoj G [.NET MVP]
> Site: http://www15.brinkster.com/manoj4dotnet
> Blog: http://msmvps.com/manoj/
>
> "Maximus" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>>Hi Everyone,
>>
>>I was using Inprocess session objects, but incase of aspnet process
>>crashes the session objects were lost as a result I decided to shift to
>>out of porocess session objects. For this i had to serialize the
>>objects. While doing that I made the classes serializable whose objects
>>I store in sessions. However, when I run the application I get the
>>following error.
>>
>>
>>
>>
>>
>>
>>Unable to serialize the session state. Please note that non-serializable
>>objects or MarshalByRef objects are not permitted when session state
>>mode is 'StateServer' or 'SQLServer'.
>>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. Please note that non-serializable objects or MarshalByRef
>>objects are not permitted when session state mode is 'StateServer' or
>>'SQLServer'.
>>
>>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: The type ASP.default_aspx in Assembly h5ahqjmx,
>>Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as
>>serializable.]
>>
>>

>
> System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMember
> s(RuntimeType
>
>>type, Boolean excludeNonSerializable) +853
>>
>>System.Runtime.Serialization.FormatterServices.G etSerializableMembers(Type
>>type, StreamingContext context) +300
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInf
> o()
>
>>+103
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize
> (Object
>
>>obj, ISurrogateSelector surrogateSelector, StreamingContext context,
>>SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Obj
> ect
>
>>obj, ISurrogateSelector surrogateSelector, StreamingContext context,
>>SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Write(WriteObjec
> tInfo
>
>>objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object
>
>>graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +738
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Str
> eam
>
>>serializationStream, Object graph, Header[] headers, Boolean fCheck) +136
>>
>>

>
> System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Str
> eam


>>serializationStream, Object graph) +13
>> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
>>BinaryWriter writer)
>>
>>[HttpException (0x80004005): Unable to serialize the session state.
>>Please note that non-serializable objects or MarshalByRef objects are
>>not permitted when session state mode is 'StateServer' or 'SQLServer'.]
>> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
>>BinaryWriter writer)
>> System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter

>
> writer)
>
>>System.Web.SessionState.StateClientManager.Seria lize(SessionStateItem
>>item, Stream stream)
>>
>>

>
> System.Web.SessionState.OutOfProcStateClientManage r.System.Web.SessionState.
> IStateClientManager.Set(String
>
>>id, SessionStateItem item, Boolean inStorage)
>> System.Web.SessionState.SessionStateModule.OnRelea seState(Object
>>source, EventArgs eventArgs)
>>
>>

>
> System.Web.SyncEventExecutionStep.System.Web.HttpA pplication+IExecutionStep.
> Execute()
>
>>+60
>> System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
>>completedSynchronously) +87
>>
>>
>>
>>
>>I'll appreciate if anybody could help me with this.
>>
>>Thanks.
>>

>
>
>


 
Reply With Quote
 
Gaurav Khanna [C# MVP]
Guest
Posts: n/a
 
      01-28-2004
Hi!

Thats a temporary assembly which the ASP.NET runtime creates for you when
compiling the page before executing it.

That said, ensure that any classes instantiated within your page are also
serializable. The object graph, which Manoj referred to in his reply, not
only includes a serializable class's members, but also any objects
referenced by the class's objects.

--
Regards,
Kumar Gaurav Khanna
-----------------------------------------------------------------
Microsoft MVP - C#/.NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
OpSupport - Spelunking Rotor
http://opsupport.sscli.net/
Bangalore .NET Users' Group
http://groups.msn.com/bdotnet/
"Maximus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Manoj,
>
> Thanks for the reply, I tried that and have marked all the objects which
> I could. In most cases it would tell me which object it could not
> serialize. But here it is saying it cannot serialize 'ASP.default_aspx
> in Assembly 9iq31h5o'.
> What I dont understand is why is it trying to serialize the default.aspx
> page and also where is this assmebly Assembly 9iq31h5o created.
>
> Any help will be appreciated.
>
>
>
> Manoj G [MVP] wrote:
>
> > You can serialize an object of a class if the class and all its members

(the
> > object graph) are themselves serializable. For Session state objects

they
> > also should not be derived from MarshalByRefObject class. Check if all

the
> > members themselves are serializable and also that none of them are
> > MarshalByRefObjects. If there are any, you can mark them with a
> > NonSerialized attribute, so that the formatter does not serialize these
> > (But, ofcource the state of the object in this case will be incomplete).
> >
> > --
> > HTH,
> > Manoj G [.NET MVP]
> > Site: http://www15.brinkster.com/manoj4dotnet
> > Blog: http://msmvps.com/manoj/
> >
> > "Maximus" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >
> >>Hi Everyone,
> >>
> >>I was using Inprocess session objects, but incase of aspnet process
> >>crashes the session objects were lost as a result I decided to shift to
> >>out of porocess session objects. For this i had to serialize the
> >>objects. While doing that I made the classes serializable whose objects
> >>I store in sessions. However, when I run the application I get the
> >>following error.
> >>
> >>
> >>
> >>
> >>
> >>
> >>Unable to serialize the session state. Please note that non-serializable
> >>objects or MarshalByRef objects are not permitted when session state
> >>mode is 'StateServer' or 'SQLServer'.
> >>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. Please note that non-serializable objects or MarshalByRef
> >>objects are not permitted when session state mode is 'StateServer' or
> >>'SQLServer'.
> >>
> >>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: The type ASP.default_aspx in Assembly h5ahqjmx,
> >>Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as
> >>serializable.]
> >>
> >>

> >
> >

System.Runtime.Serialization.FormatterServices.Int ernalGetSerializableMember
> > s(RuntimeType
> >
> >>type, Boolean excludeNonSerializable) +853
> >>

>
>>System.Runtime.Serialization.FormatterServices.G etSerializableMembers(Type
> >>type, StreamingContext context) +300
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitMemberInf
> > o()
> >
> >>+103
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.InitSerialize
> > (Object
> >
> >>obj, ISurrogateSelector surrogateSelector, StreamingContext context,
> >>SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +493
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Wri teObjectInfo.Serialize(Obj
> > ect
> >
> >>obj, ISurrogateSelector surrogateSelector, StreamingContext context,
> >>SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter) +48
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Write(WriteObjec
> > tInfo
> >
> >>objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +515
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Obj ectWriter.Serialize(Object
> >
> >>graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)

+738
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Str
> > eam
> >
> >>serializationStream, Object graph, Header[] headers, Boolean fCheck)

+136
> >>
> >>

> >
> >

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Serialize(Str
> > eam

>
> >>serializationStream, Object graph) +13
> >> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
> >>BinaryWriter writer)
> >>
> >>[HttpException (0x80004005): Unable to serialize the session state.
> >>Please note that non-serializable objects or MarshalByRef objects are
> >>not permitted when session state mode is 'StateServer' or 'SQLServer'.]
> >> System.Web.Util.AltSerialization.WriteValueToStrea m(Object value,
> >>BinaryWriter writer)
> >> System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter

> >
> > writer)
> >
> >>System.Web.SessionState.StateClientManager.Seria lize(SessionStateItem
> >>item, Stream stream)
> >>
> >>

> >
> >

System.Web.SessionState.OutOfProcStateClientManage r.System.Web.SessionState.
> > IStateClientManager.Set(String
> >
> >>id, SessionStateItem item, Boolean inStorage)
> >> System.Web.SessionState.SessionStateModule.OnRelea seState(Object
> >>source, EventArgs eventArgs)
> >>
> >>

> >
> >

System.Web.SyncEventExecutionStep.System.Web.HttpA pplication+IExecutionStep.
> > Execute()
> >
> >>+60
> >> System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
> >>completedSynchronously) +87
> >>
> >>
> >>
> >>
> >>I'll appreciate if anybody could help me with this.
> >>
> >>Thanks.
> >>

> >
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to move from java object serialization to xml serialization? Dimitri Ognibene Java 4 09-02-2006 07:32 AM
Object serialization XML vs java serialization plasticfloor@gmail.com Java 3 06-14-2006 03:45 AM
Serialization Problems and books on serialization? sinleeh@hotmail.com Java 8 01-02-2005 02:40 PM
avoiding XML serialization, different WSDL generation, soap serialization Ramunas Urbonas ASP .Net Web Services 1 07-27-2004 09:57 PM
Serialization error Maximus ASP .Net 2 01-26-2004 11:10 PM



Advertisments