Products

Solutions

Resources

Partners

Community

Blog

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesError Serializing Value...?Error Serializing Value...?
Previous
 
Next
New Post
3/7/2012 11:57 AM
 

I am getting a strange error and I have absolutly no clue where it's coming from because the IDE doesn't register a "break" at the point the error occurs.

A critical error has occurred. Error serializing value 'ESB.Modules.EAP_Provider.Components.WebControls.WorkHours+WorkHoursList' of type 'ESB.Modules.EAP_Provider.Components.WebControls.WorkHours+WorkHoursList.'

Can anyone help me? This error is driving my bonkers and causing an entire section of my module to not function.


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
3/7/2012 3:12 PM
 
I found my answer.  Apparently the IDE doesn't halt when placing object's into the ViewState if an error occurs.  Once I figured out it was the ViewState causing the issue, I labeled all the items within my major class as serializable. That cleared up my problem.

Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
6/1/2012 1:17 PM
 

What do you mean?  I'm coming across the same error when trying to place objects in Viewstate...

Is there an error placing the object in Viewstate? 


 
New Post
6/1/2012 1:30 PM
 

ViewState requires that all objects placed within it are serialized. If you place an object into the ViewState which is not serializable, then an error will occur. Although you will see the resulting error on your webpage, if you try to run your code in debug mode, a ViewState serializing error doesn’t cause a “halt” in code for you so see where the error is happening.

To fix this problem, you have to update the code of the class/object that you are attempting to store into the ViewState. In the code, you need to flag the class/object as “Serializable”. Be aware that if your class/object has other custom class/object's nested inside it, all the "nested classes" used must also be serializable. Once you have marked every single class associated as serializable, then this error will go away.

Below is a sample of how to do that in both VB.Net and C#.

VB.Net
<Serializable> _
Public Class MyObject
 Public n1 As Integer = 0
 Public n2 As Integer = 0
 Public str As [String] = Nothing
End Class

C#
[Serializable]
public class MyObject {
  public int n1 = 0;
  public int n2 = 0;
  public String str = null;
}

Hope this helped!


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
6/1/2012 2:20 PM
 

I see what you mean now... I'm trying to store LINQ to SQL objects in viewstate.  I ended up finding a blog that discusses a workaround which allows them to be stored.  Apparently, the Unidirectional setting for serialization method on the data context doesn't work...

http://aspnet.canalblog.com/archives/...

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesError Serializing Value...?Error Serializing Value...?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out