View State Serialization problem

  • Thread starter Thread starter Karahan Celikel
  • Start date Start date
K

Karahan Celikel

I have a custom collection class subclassing the CollectionBase. Even if it
is marked as [Serializable] it gives an error when I try to store it in
viewstate. Following is the error message and stack trace info.


Error:
The type 'InTouch.Wip.Web.Admin.Content.WrappedContentCollection' must be
marked as Serializable or have a TypeConverter other than ReferenceConverter
to be put in viewstate


Stack:
HttpException (0x80004005): The type
'InTouch.Wip.Web.Admin.Content.WrappedContentCollection' must be marked as
Serializable or have a TypeConverter other than ReferenceConverter to be put
in viewstate.]
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +1480
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +430
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +764
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +739
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +847
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +430
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +897
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +430
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +897
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +430
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +897
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +430
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +897
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +430
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +897
System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
value) +872
System.Web.UI.LosFormatter.SerializeInternal(TextWriter output, Object
value) +102
System.Web.UI.Page.OnFormRender(HtmlTextWriter writer, String
formUniqueID) +143
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
+35
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +262
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
ASP.Cm_aspx.__Render__control1(HtmlTextWriter __output, Control
parameterContainer) in xxxx.cs
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
System.Web.UI.Page.ProcessRequestMain() +1929


Thanks in advance.

Karahan Celikel
 
Hello Karahan,

Thanks for posting in the group.

Under this situation, the framework don't know the complex object's state
management requirements and so can't provide the management automatically
by creating TypeConverter. You have to deal with IStateManager interface as
it provides the link for state management for complex objects. This has
also the benefit that you can optimize the state management so that no more
than everything absolutely required is stored to ViewState (to make less
overhead).

For your questions, I think you need to implement IStateManager on my
collection and a type converter on my collection item.

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: "Karahan Celikel" <[email protected]>
!Subject: View State Serialization problem
!Date: Fri, 22 Aug 2003 15:21:24 -0500
!Lines: 69
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <[email protected]>
!Newsgroups: microsoft.public.dotnet.framework
!NNTP-Posting-Host: 126-23-206.biztyp2.ksle.everestkc.net 64.126.23.206
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:51997
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!I have a custom collection class subclassing the CollectionBase. Even if it
!is marked as [Serializable] it gives an error when I try to store it in
!viewstate. Following is the error message and stack trace info.
!
!
!Error:
!The type 'InTouch.Wip.Web.Admin.Content.WrappedContentCollection' must be
!marked as Serializable or have a TypeConverter other than
ReferenceConverter
!to be put in viewstate
!
!
!Stack:
!HttpException (0x80004005): The type
!'InTouch.Wip.Web.Admin.Content.WrappedContentCollection' must be marked as
!Serializable or have a TypeConverter other than ReferenceConverter to be
put
!in viewstate.]
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +1480
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +430
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +764
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +739
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +847
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +430
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +897
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +430
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +897
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +430
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +897
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +430
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +897
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +430
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +897
! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!value) +872
! System.Web.UI.LosFormatter.SerializeInternal(TextWriter output, Object
!value) +102
! System.Web.UI.Page.OnFormRender(HtmlTextWriter writer, String
!formUniqueID) +143
! System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter
writer)
!+35
! System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +262
! System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
! ASP.Cm_aspx.__Render__control1(HtmlTextWriter __output, Control
!parameterContainer) in xxxx.cs
! System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
! System.Web.UI.Control.Render(HtmlTextWriter writer) +7
! System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
! System.Web.UI.Page.ProcessRequestMain() +1929
!
!
!Thanks in advance.
!
!Karahan Celikel
!
!
!
 
Hello Karahan,

You are welcome. :)

Thanks for participating the community.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: "Karahan Celikel" <[email protected]>
!References: <[email protected]>
<[email protected]>
!Subject: Re: View State Serialization problem
!Date: Tue, 26 Aug 2003 10:36:10 -0500
!Lines: 126
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <uGsUJf#[email protected]>
!Newsgroups: microsoft.public.dotnet.framework
!NNTP-Posting-Host: 126-23-206.biztyp2.ksle.everestkc.net 64.126.23.206
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:52272
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!Thanks a lot. It was very helpful.
!
!
!!> Hello Karahan,
!>
!> Thanks for posting in the group.
!>
!> Under this situation, the framework don't know the complex object's state
!> management requirements and so can't provide the management automatically
!> by creating TypeConverter. You have to deal with IStateManager interface
!as
!> it provides the link for state management for complex objects. This has
!> also the benefit that you can optimize the state management so that no
!more
!> than everything absolutely required is stored to ViewState (to make less
!> overhead).
!>
!> For your questions, I think you need to implement IStateManager on my
!> collection and a type converter on my collection item.
!>
!> Hope that helps.
!>
!> Best regards,
!> Yanhong Huang
!> Microsoft Online Partner Support
!>
!> Get Secure! - www.microsoft.com/security
!> This posting is provided "AS IS" with no warranties, and confers no
!rights.
!>
!> --------------------
!> !From: "Karahan Celikel" <[email protected]>
!> !Subject: View State Serialization problem
!> !Date: Fri, 22 Aug 2003 15:21:24 -0500
!> !Lines: 69
!> !X-Priority: 3
!> !X-MSMail-Priority: Normal
!> !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!> !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!> !Message-ID: <[email protected]>
!> !Newsgroups: microsoft.public.dotnet.framework
!> !NNTP-Posting-Host: 126-23-206.biztyp2.ksle.everestkc.net 64.126.23.206
!> !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
!> !Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:51997
!> !X-Tomcat-NG: microsoft.public.dotnet.framework
!> !
!> !I have a custom collection class subclassing the CollectionBase. Even if
!it
!> !is marked as [Serializable] it gives an error when I try to store it in
!> !viewstate. Following is the error message and stack trace info.
!> !
!> !
!> !Error:
!> !The type 'InTouch.Wip.Web.Admin.Content.WrappedContentCollection' must
be
!> !marked as Serializable or have a TypeConverter other than
!> ReferenceConverter
!> !to be put in viewstate
!> !
!> !
!> !Stack:
!> !HttpException (0x80004005): The type
!> !'InTouch.Wip.Web.Admin.Content.WrappedContentCollection' must be marked
!as
!> !Serializable or have a TypeConverter other than ReferenceConverter to be
!> put
!> !in viewstate.]
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +1480
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +430
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +764
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +739
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +847
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +430
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +897
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +430
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +897
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +430
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +897
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +430
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +897
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +430
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +897
!> ! System.Web.UI.LosFormatter.SerializeValue(TextWriter output, Object
!> !value) +872
!> ! System.Web.UI.LosFormatter.SerializeInternal(TextWriter output,
Object
!> !value) +102
!> ! System.Web.UI.Page.OnFormRender(HtmlTextWriter writer, String
!> !formUniqueID) +143
!> ! System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter
!> writer)
!> !+35
!> ! System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
+262
!> ! System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
!> ! ASP.Cm_aspx.__Render__control1(HtmlTextWriter __output, Control
!> !parameterContainer) in xxxx.cs
!> ! System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
!> ! System.Web.UI.Control.Render(HtmlTextWriter writer) +7
!> ! System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
!> ! System.Web.UI.Page.ProcessRequestMain() +1929
!> !
!> !
!> !Thanks in advance.
!> !
!> !Karahan Celikel
!> !
!> !
!> !
!>
!
!
!
 
Back
Top