We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AppStateSerializer problem

Thread ID:





9094 Dec 5,2003 04:31 PM UTC Dec 8,2003 03:44 AM UTC WinForms 3
Tags: Tools
Roland Martin
Asked On December 5, 2003 04:31 PM UTC

I am attempting to use AppStateSerializer to save/restore an object. I am using SerializeMode.XMLFile, the serialization works fine but DeserializeObject fails on line 817 of AppSerializer.cs. The source comments say the following: // The depersisted hashtable will contain a string representation of // the XML data. Convert the contents of the String into a bytearray // and deserialize the bytearray using a memorystream. In Visual Studio this is not true, the hashtable contains an already deserialized object, not a String version. The following fails: byte[] bytearray = encoding.GetBytes(ht[strname] as String); Additional information: String reference not set to an instance of a String. Is there anything I can do to fix this? Thanks - Roland

Gurucharan Patwal [Syncfusion]
Replied On December 5, 2003 08:22 PM UTC

Hi Roland, Please take a look at the sample in the folder - ..\Syncfusion\Essential Suite\Shared\Samples\AppStateSerializerDemo which shows how an AppStateSerializer could be used to save/load state information of a control on a form. Refer to this code snippet : AppStateSerializer.InitializeSingleton(SerializeMode.XMLFile, "GlobalState"); Here state information is persisted and loaded from a XMLFile name GlobalState. Please let us know what object (like ToolBars, docking windows etc.) are you referring to here, so that we could send you a specific sample that meets your requirements. Thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Roland Martin
Replied On December 6, 2003 12:10 AM UTC

I am attempting to serialize/deserialize my own object, not dockable window or toolbar state. The object has a few int members. Is the problem that AppStateSerializer only supports simple types and not complex objects? I can serialize/deserialize individual int/string/bool fine, I just cannot deserialize an object with multiple member variables.

Holger Persch
Replied On December 8, 2003 03:44 AM UTC

I have done this already in my project and everything works fine. I am serializing and deserializing a class with about 9 fields in a XML based file (SerializeMode.XMLFile) without any problems. The class contains some strings, bools and also a ArrayList. Regards, Holger


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon