Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Fixes deserializaing TimeZoneInfo by putting back the IDeserializatio…
Browse files Browse the repository at this point in the history
…nCallback.OnDeserialization method.
  • Loading branch information
morganbr committed May 31, 2017
1 parent a2abadf commit f32ce49
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/mscorlib/src/System/TimeZoneInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,24 @@ public static TimeZoneInfo CreateCustomTimeZone(

void IDeserializationCallback.OnDeserialization(object sender)
{
throw new PlatformNotSupportedException();
try
{
bool adjustmentRulesSupportDst;
ValidateTimeZoneInfo(_id, _baseUtcOffset, _adjustmentRules, out adjustmentRulesSupportDst);

if (adjustmentRulesSupportDst != _supportsDaylightSavingTime)
{
throw new SerializationException(SR.Format(SR.Serialization_CorruptField, "SupportsDaylightSavingTime"));
}
}
catch (ArgumentException e)
{
throw new SerializationException(SR.Serialization_InvalidData, e);
}
catch (InvalidTimeZoneException e)
{
throw new SerializationException(SR.Serialization_InvalidData, e);
}
}

void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Expand Down

0 comments on commit f32ce49

Please sign in to comment.