|
Bugzilla – Full Text Bug Listing |
| Summary: | TimeZoneInfo throws exception when serialized | ||
|---|---|---|---|
| Product: | [Mono] Mono: Class Libraries | Reporter: | James Clegg <jclegg> |
| Component: | Sys.Core | Assignee: | Michael Miller <michael.miller> |
| Status: | NEW --- | QA Contact: | Mono Bugs <mono-bugs> |
| Severity: | Major | ||
| Priority: | P5 - None | ||
| Version: | 2.10.x | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
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