From: Morgan Brown Date: Thu, 1 Jun 2017 12:09:07 +0000 (-0700) Subject: Fixes deserializaing TimeZoneInfo by putting back the IDeserializationCallback.OnDese... X-Git-Tag: submit/tizen/20210909.063632~11030^2~6925^2~585 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=310360b30792660f6768f45183e4465e57a7b218;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fixes deserializaing TimeZoneInfo by putting back the IDeserializationCallback.OnDeserialization method. (dotnet/coreclr#12024) Commit migrated from https://github.com/dotnet/coreclr/commit/beaefc2188a4cf46c99e522f4ed0b57507b07633 --- diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs index 3450311..8ed7e22 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs @@ -1012,7 +1012,24 @@ namespace System 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)