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)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

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.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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