Welcome Guest Search | Active Topics | Sign In | Register

Type 'EO.Web.TreeNode' in Assembly 'EO.Web, Version=4.0.35.2, Culture=neutral, PublicKeyToken=e92353a6bf73fffc' is not marked as Options
Ben Switzer
Posted: Friday, September 21, 2007 5:08:36 AM
Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 30
When we setup a state server we get the following error:
Server Error in '/' Application.


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 'EO.Web.TreeNode' in Assembly 'EO.Web, Version=4.0.35.2, Culture=neutral, PublicKeyToken=e92353a6bf73fffc' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +2271925
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +245
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +88
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +305
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +50
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +438
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +1513

[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) +1602
System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +34
System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer) +627
System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData item, Stream stream) +257
System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte[]& buf, Int32& length) +60
System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +87
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +355
System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs) +152
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64





Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832
eo_support
Posted: Friday, September 21, 2007 6:02:17 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Ben,

Do you happen to keep a reference of our control in the Session? You can not do that.

Thanks
Ben Switzer
Posted: Friday, September 21, 2007 7:02:14 AM
Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 30
I dont keep the treeview control in session but I do keep a reference to a treenode in session. Why would this not be supported?
eo_support
Posted: Friday, September 21, 2007 7:11:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
That explains why. We don't support it because it makes no sense. Most of the time a TreeNode lives in the context of a TreeView, which lives in a even bigger context of the Page. If we were to support that, there is a chance that when .NET serializes the TreeNode, it will grab the TreeView and even the page and try to stuff them all into your state server.

Even with in process session you don't want to do that either. Whenever you keep a reference to the TreeNode, you might be also keeping an reference to the TreeView and the Page. All these is in memory so it probably won't matter much if your site load is not that big.

In generally, you should only keep simple data item in the Session.
Ben Switzer
Posted: Friday, September 21, 2007 7:49:24 AM
Rank: Advanced Member
Groups: Member

Joined: 5/30/2007
Posts: 30
When I originally started using your Treeview control there was no selectednode property. So I kept what node was selected within session as a reference. I will have to look through my code to see the best way to change this for some various functions I've written Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.