GoDiagram Win Reference
TestSerialization Method

Test serializing and deserializing this document, to help discover unserializable objects by getting SerializationExceptions when debugging serialization errors such as during a copy-and-paste.
Syntax
'Declaration
 
Public Function TestSerialization() As GoDocument
public GoDocument TestSerialization()

Return Value

a copy of this document, including all of its contents and any referenced objects
Remarks

Serialization of a GoDocument and its GoObjects is important for copy-and-paste and drag-and-drop (in Windows Forms) and for session state (in ASP.NET Web Forms). Sometimes copy-and-paste will result in missing objects, due to unserializable objects or serialization errors.

You can call this method to help debug serialization problems. This method serializes this document into a MemoryStream and then immediately deserializes it back into a newly copied document. If there is a problem, you are likely to get a SerializationException, which should give you a clue as to which class needs to be attributed Serializable or which fields need to be attributed NonSerialized.

This method is implemented as: public GoDocument TestSerialization() { MemoryStream memstream = new MemoryStream(); IFormatter oformatter = new BinaryFormatter(); oformatter.Serialize(memstream, this); memstream.Position = 0; IFormatter iformatter = new BinaryFormatter(); return iformatter.Deserialize(memstream) as GoDocument; }

Because this may consume significant time and space without actually changing anything, do not call this method in a production environment except when investigating a serialization problem.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GoDocument Class
GoDocument Members

 

 


© 2015. Northwoods Software Corporation. All Rights Reserved.

Send Feedback