Error Segmentation for View State

I'm having problems serializing data for view state. I am using VS2010 and when I try to add a property to the view state, I get the following error message:

Error serializing value 'System.Collections.Generic.List`1[Access.ARW.Business.Filters.Parameters.Parameter]' of type 'System.Collections.Generic.List`1[[Access.ARW.Business.Filters.Parameters.Parameter, Access.ARW.Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].' 

I added the [Serializable] attribute above the classes I'm trying to serialize, but I still get this error ... any ideas

Here is a property declaration that is in class A:

 private List<Filters.Parameters.Parameter> ReportParameters { get { if (ViewState["ReportParameters"] == null) { ViewState["ReportParameters"] = new List<Filters.Parameters.Parameter>(); } return (List<Filters.Parameters.Parameter>) ViewState["ReportParameters"]; } set { ViewState["ReportParameters"] = value; } } 
+4
source share
1 answer

Did you fail to add the Serializable attribute to one of the components of the class? Try adding parts of the class one by one to the ViewState until you find one that is wrong.

+6
source

Source: https://habr.com/ru/post/1394434/


All Articles