Bug 44255 - Inconsistent results in the serialization of TimeZoneInfo.
Summary: Inconsistent results in the serialization of TimeZoneInfo.
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 5.0 (2017-02)
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Egorbo
URL:
Depends on:
Blocks:
 
Reported: 2016-09-13 17:31 UTC by FernandoVM
Modified: 2017-10-19 19:34 UTC (History)
8 users (show)

See Also:
Tags: bugpool-archive
Is this bug a regression?: ---
Last known good build:


Attachments
Private fields inspect. (58.51 KB, image/png)
2016-09-13 17:31 UTC, FernandoVM
Details
Sample Project (311.77 KB, application/x-zip-compressed)
2017-06-26 17:50 UTC, John Miller [MSFT]
Details

Description FernandoVM 2016-09-13 17:31:05 UTC
Created attachment 17442 [details]
Private fields inspect.

Inconsistent results in the serialization of TimeZoneInfo. A new instance generated after the methods ToSerializedString and FromSerializedString aren't evaluated as equals. See the bellow code and the picture attached.

[Test]
public void TimeZoneInfoSerializeTest()
{
    var tmz = TimeZoneInfo.GetSystemTimeZones().First();
    var tmzS = TimeZoneInfo.FromSerializedString(tmz.ToSerializedString());

    Assert.AreEqual(tmz, tmzS);
}

The error seems be with the private fields adjustmentRules (before null, after AdjustmentRule[0]) and daylightDisplayName (before "", after "GMT").

I have tested using unit tests of a xamarin forms library running on the Android.
Comment 1 FernandoVM 2016-09-13 17:32:56 UTC
Please, see the remarks in the https://msdn.microsoft.com/en-us/library/bb382565(v=vs.110).aspx.
Comment 3 John Miller [MSFT] 2017-06-26 17:50:36 UTC
I was able to reproduce this issue on Mac using Mono. 

## Steps to reproduce

1. Use the attached project to verify a nunit test. 

## Actual Results

On Windows, using .NET it passes. 
On Mac, using Mono it fails. 

## Expected Results

Passes on both platforms.
Comment 4 John Miller [MSFT] 2017-06-26 17:50:59 UTC
Created attachment 23119 [details]
Sample Project
Comment 6 Ludovic Henry 2017-09-20 14:17:16 UTC
https://github.com/mono/mono/pull/5576
Comment 7 Marek Safar 2017-09-21 06:04:33 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.