Fixes deserializaing TimeZoneInfo by putting back the IDeserializationCallback.OnDese...
authorMorgan Brown <morganbr@users.noreply.github.com>
Thu, 1 Jun 2017 12:09:07 +0000 (05:09 -0700)
committerViktor Hofer <viktor.hofer@microsoft.com>
Thu, 1 Jun 2017 12:09:07 +0000 (14:09 +0200)
Commit migrated from https://github.com/dotnet/coreclr/commit/beaefc2188a4cf46c99e522f4ed0b57507b07633

src/coreclr/src/mscorlib/src/System/TimeZoneInfo.cs

index 3450311..8ed7e22 100644 (file)
@@ -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)