Below is the exact code snippet from your help documentation. I use the same to save the layout to a file and reload it back from the file. It always throws a serialization error everytime the save is called.
// Create a file stream to which the layout will be serialized
System.IO.FileMode.OpenOrCreate);
// Save the layout to the file that was just created
explorer.SaveAsBinary(fileStream);
// Close the file stream
fileStream.Close();
Exception:
explorer.SaveAsBinary(fileStream) 'explorer.SaveAsBinary(fileStream)' threw an exception of type 'System.ApplicationException' void {System.ApplicationException}
base {"Serialization error!"} System.Exception {System.ApplicationException} Inner Exception: "Object reference not set to an instance of an object."
Stack Trace:
at Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarItem.ShouldSerializeToolTipText() at Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarItem.System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[ inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[ headers, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar.SaveHelper(Stream stream, Boolean saveAsBinary)
Any help will be greatly appreciated.
Thanks for your immediate response. I found the place where the tooltiptext was set to null and set it to string.Empty and everything works fine. Thank you.
This is a bug; you should report it so that you are notified when the fix becomes available. Note tnat this bug should only manifest itself when the ToolTipText property is explicitly set to null; if you set it to string.Empty instead, that will prevent the exception from being thrown.