Bug 44255 - Inconsistent results in the serialization of TimeZoneInfo.
Summary: Inconsistent results in the serialization of TimeZoneInfo.
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
Depends on:
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:

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

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.

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
Comment 7 Marek Safar 2017-09-21 06:04:33 UTC
Fixed in master

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

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