diff options
author | Morgan Brown <morganbr@users.noreply.github.com> | 2017-06-01 05:09:07 -0700 |
---|---|---|
committer | Viktor Hofer <viktor.hofer@microsoft.com> | 2017-06-01 14:09:07 +0200 |
commit | beaefc2188a4cf46c99e522f4ed0b57507b07633 (patch) | |
tree | 6d0dfaa887db041dc9948a602b267cea9a2af28f /src | |
parent | 567c9aaf4bdb1ce3709decd46105ee7c4c4faf9f (diff) | |
download | coreclr-beaefc2188a4cf46c99e522f4ed0b57507b07633.tar.gz coreclr-beaefc2188a4cf46c99e522f4ed0b57507b07633.tar.bz2 coreclr-beaefc2188a4cf46c99e522f4ed0b57507b07633.zip |
Fixes deserializaing TimeZoneInfo by putting back the IDeserializationCallback.OnDeserialization method. (#12024)
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/src/System/TimeZoneInfo.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mscorlib/src/System/TimeZoneInfo.cs b/src/mscorlib/src/System/TimeZoneInfo.cs index 3450311835..8ed7e229c0 100644 --- a/src/mscorlib/src/System/TimeZoneInfo.cs +++ b/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) |