[Mono-bugs] [Bug 775116] New: TimeZoneInfo throws exception when serialized
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Aug 8 19:48:07 UTC 2012
https://bugzilla.novell.com/show_bug.cgi?id=775116
https://bugzilla.novell.com/show_bug.cgi?id=775116#c0
Summary: TimeZoneInfo throws exception when serialized
Classification: Mono
Product: Mono: Class Libraries
Version: 2.10.x
Platform: All
OS/Version: All
Status: NEW
Severity: Major
Priority: P5 - None
Component: Sys.Core
AssignedTo: michael.miller at suse.com
ReportedBy: jclegg at reflexsystems.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101
Firefox/14.0.1
TimeZoneInfo implements ISerializable, but the GetObjectData() method simply
throws a NotImplementedException.
Someone should be able to serialize an object of this type using a
BinaryFormater
(works on MS .NET, and it's marked as serializable), but because of this, you
get an exception if you try.
Reproducible: Always
Steps to Reproduce:
1. Create a TimeZoneInfo instance
2. Try to serialize it with a BinaryFormatter
Actual Results:
throw exception
Expected Results:
it should serialize the object properly without throwing an exception. It
should have code to deserialize the object as well.
This snippet will throw the exception. It doesnt matter if it's the local time
zone or any other:
TimeZoneInfo tzi = TimeZoneInfo.Local;
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, tzi);
ms.Seek(0, SeekOrigin.Begin);
var tzi2= bf.Deserialize(ms);
/// in the TimeZoneInfo class, the following (lack of) code is the problem:
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext
{
throw new NotImplementedException ();
}
void IDeserializationCallback.OnDeserialization (object sender)
{
throw new NotImplementedException ();
}
it looks like there is also a missing custom deserialization constructor
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list