Skip to content

POSIX TimeZoneInfo.ToSerializedString() produces invalid string #49491

@BerndNK

Description

@BerndNK

Describe the bug

Usage of
TimeZoneInfo.Local.ToSerializedString()
produces invalid string in Blazor WASM.

To Reproduce

A public repo can be found here

Create a new Blazor WASM project. Insert the following line in index.razor:
<h1>@(TimeZoneInfo.FromSerializedString(TimeZoneInfo.Local.ToSerializedString()))</h1>
Execution will result in a runtime exception. (See below)

Since this is very likely an issue with local time, this is the output of TimeZoneInfo.Local.ToSerializedString() on my machine, when executed within a .razor Blazor WASM page:
Europe/Berlin;60;(UTC+01:00) CET;CET;CET;[01:01:0001;04:01:1893;0;[1;00:00:00;1;1;];[1;00:06:31;4;1;];][04:01:1893;04:30:1916;0;[1;00:06:32;4;1;];[1;22:59:59;4;30;];][04:30:1916;10:01:1916;60;[1;23:00:00;4;30;];[1;00:59:59;10;1;];][10:01:1916;04:16:1917;0;[1;00:00:00;10;1;];[1;01:59:59;4;16;];][04:16:1917;09:17:1917;60;[1;02:00:00;4;16;];[1;02:59:59;9;17;];][09:17:1917;04:15:1918;0;[1;02:00:00;9;17;];[1;01:59:59;4;15;];][04:15:1918;09:16:1918;60;[1;02:00:00;4;15;];[1;02:59:59;9;16;];][09:16:1918;04:01:1940;0;[1;02:00:00;9;16;];[1;01:59:59;4;1;];][04:01:1940;11:02:1942;60;[1;02:00:00;4;1;];[1;02:59:59;11;2;];][11:02:1942;03:29:1943;0;[1;02:00:00;11;2;];[1;01:59:59;3;29;];][03:29:1943;10:04:1943;60;[1;02:00:00;3;29;];[1;02:59:59;10;4;];][10:04:1943;04:03:1944;0;[1;02:00:00;10;4;];[1;01:59:59;4;3;];][04:03:1944;10:02:1944;60;[1;02:00:00;4;3;];[1;02:59:59;10;2;];][10:02:1944;04:02:1945;0;[1;02:00:00;10;2;];[1;01:59:59;4;2;];][04:02:1945;05:24:1945;60;[1;02:00:00;4;2;];[1;01:59:59;5;24;];][05:24:1945;09:24:1945;120;[1;01:00:00;5;24;];[1;02:59:59;9;24;];][09:24:1945;11:18:1945;60;[1;01:00:00;9;24;];[1;02:59:59;11;18;];][11:18:1945;12:31:1945;0;[1;02:00:00;11;18;];[1;23:59:59;12;31;];][01:01:1946;04:14:1946;0;[1;00:00:00;1;1;];[1;01:59:59;4;14;];][04:14:1946;10:07:1946;60;[1;02:00:00;4;14;];[1;02:59:59;10;7;];][10:07:1946;04:06:1947;0;[1;02:00:00;10;7;];[1;02:59:59;4;6;];][04:06:1947;05:11:1947;60;[1;03:00:00;4;6;];[1;02:59:59;5;11;];][05:11:1947;06:29:1947;120;[1;02:00:00;5;11;];[1;02:59:59;6;29;];][06:29:1947;10:05:1947;60;[1;01:00:00;6;29;];[1;02:59:59;10;5;];][10:05:1947;04:18:1948;0;[1;02:00:00;10;5;];[1;01:59:59;4;18;];][04:18:1948;10:03:1948;60;[1;02:00:00;4;18;];[1;02:59:59;10;3;];][10:03:1948;04:10:1949;0;[1;02:00:00;10;3;];[1;01:59:59;4;10;];][04:10:1949;10:02:1949;60;[1;02:00:00;4;10;];[1;02:59:59;10;2;];][10:02:1949;12:31:1979;0;[1;02:00:00;10;2;];[1;23:59:59;12;31;];][01:01:1980;04:06:1980;0;[1;00:00:00;1;1;];[1;01:59:59;4;6;];][04:06:1980;09:28:1980;60;[1;02:00:00;4;6;];[1;02:59:59;9;28;];][09:28:1980;03:29:1981;0;[1;02:00:00;9;28;];[1;01:59:59;3;29;];][03:29:1981;09:27:1981;60;[1;02:00:00;3;29;];[1;02:59:59;9;27;];][09:27:1981;03:28:1982;0;[1;02:00:00;9;27;];[1;01:59:59;3;28;];][03:28:1982;09:26:1982;60;[1;02:00:00;3;28;];[1;02:59:59;9;26;];][09:26:1982;03:27:1983;0;[1;02:00:00;9;26;];[1;01:59:59;3;27;];][03:27:1983;09:25:1983;60;[1;02:00:00;3;27;];[1;02:59:59;9;25;];][09:25:1983;03:25:1984;0;[1;02:00:00;9;25;];[1;01:59:59;3;25;];][03:25:1984;09:30:1984;60;[1;02:00:00;3;25;];[1;02:59:59;9;30;];][09:30:1984;03:31:1985;0;[1;02:00:00;9;30;];[1;01:59:59;3;31;];][03:31:1985;09:29:1985;60;[1;02:00:00;3;31;];[1;02:59:59;9;29;];][09:29:1985;03:30:1986;0;[1;02:00:00;9;29;];[1;01:59:59;3;30;];][03:30:1986;09:28:1986;60;[1;02:00:00;3;30;];[1;02:59:59;9;28;];][09:28:1986;03:29:1987;0;[1;02:00:00;9;28;];[1;01:59:59;3;29;];][03:29:1987;09:27:1987;60;[1;02:00:00;3;29;];[1;02:59:59;9;27;];][09:27:1987;03:27:1988;0;[1;02:00:00;9;27;];[1;01:59:59;3;27;];][03:27:1988;09:25:1988;60;[1;02:00:00;3;27;];[1;02:59:59;9;25;];][09:25:1988;03:26:1989;0;[1;02:00:00;9;25;];[1;01:59:59;3;26;];][03:26:1989;09:24:1989;60;[1;02:00:00;3;26;];[1;02:59:59;9;24;];][09:24:1989;03:25:1990;0;[1;02:00:00;9;24;];[1;01:59:59;3;25;];][03:25:1990;09:30:1990;60;[1;02:00:00;3;25;];[1;02:59:59;9;30;];][09:30:1990;03:31:1991;0;[1;02:00:00;9;30;];[1;01:59:59;3;31;];][03:31:1991;09:29:1991;60;[1;02:00:00;3;31;];[1;02:59:59;9;29;];][09:29:1991;03:29:1992;0;[1;02:00:00;9;29;];[1;01:59:59;3;29;];][03:29:1992;09:27:1992;60;[1;02:00:00;3;29;];[1;02:59:59;9;27;];][09:27:1992;03:28:1993;0;[1;02:00:00;9;27;];[1;01:59:59;3;28;];][03:28:1993;09:26:1993;60;[1;02:00:00;3;28;];[1;02:59:59;9;26;];][09:26:1993;03:27:1994;0;[1;02:00:00;9;26;];[1;01:59:59;3;27;];][03:27:1994;09:25:1994;60;[1;02:00:00;3;27;];[1;02:59:59;9;25;];][09:25:1994;03:26:1995;0;[1;02:00:00;9;25;];[1;01:59:59;3;26;];][03:26:1995;09:24:1995;60;[1;02:00:00;3;26;];[1;02:59:59;9;24;];][09:24:1995;03:31:1996;0;[1;02:00:00;9;24;];[1;01:59:59;3;31;];][03:31:1996;10:27:1996;60;[1;02:00:00;3;31;];[1;02:59:59;10;27;];][10:27:1996;03:30:1997;0;[1;02:00:00;10;27;];[1;01:59:59;3;30;];][03:30:1997;10:26:1997;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:1997;03:29:1998;0;[1;02:00:00;10;26;];[1;01:59:59;3;29;];][03:29:1998;10:25:1998;60;[1;02:00:00;3;29;];[1;02:59:59;10;25;];][10:25:1998;03:28:1999;0;[1;02:00:00;10;25;];[1;01:59:59;3;28;];][03:28:1999;10:31:1999;60;[1;02:00:00;3;28;];[1;02:59:59;10;31;];][10:31:1999;03:26:2000;0;[1;02:00:00;10;31;];[1;01:59:59;3;26;];][03:26:2000;10:29:2000;60;[1;02:00:00;3;26;];[1;02:59:59;10;29;];][10:29:2000;03:25:2001;0;[1;02:00:00;10;29;];[1;01:59:59;3;25;];][03:25:2001;10:28:2001;60;[1;02:00:00;3;25;];[1;02:59:59;10;28;];][10:28:2001;03:31:2002;0;[1;02:00:00;10;28;];[1;01:59:59;3;31;];][03:31:2002;10:27:2002;60;[1;02:00:00;3;31;];[1;02:59:59;10;27;];][10:27:2002;03:30:2003;0;[1;02:00:00;10;27;];[1;01:59:59;3;30;];][03:30:2003;10:26:2003;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:2003;03:28:2004;0;[1;02:00:00;10;26;];[1;01:59:59;3;28;];][03:28:2004;10:31:2004;60;[1;02:00:00;3;28;];[1;02:59:59;10;31;];][10:31:2004;03:27:2005;0;[1;02:00:00;10;31;];[1;01:59:59;3;27;];][03:27:2005;10:30:2005;60;[1;02:00:00;3;27;];[1;02:59:59;10;30;];][10:30:2005;03:26:2006;0;[1;02:00:00;10;30;];[1;01:59:59;3;26;];][03:26:2006;10:29:2006;60;[1;02:00:00;3;26;];[1;02:59:59;10;29;];][10:29:2006;03:25:2007;0;[1;02:00:00;10;29;];[1;01:59:59;3;25;];][03:25:2007;10:28:2007;60;[1;02:00:00;3;25;];[1;02:59:59;10;28;];][10:28:2007;03:30:2008;0;[1;02:00:00;10;28;];[1;01:59:59;3;30;];][03:30:2008;10:26:2008;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:2008;03:29:2009;0;[1;02:00:00;10;26;];[1;01:59:59;3;29;];][03:29:2009;10:25:2009;60;[1;02:00:00;3;29;];[1;02:59:59;10;25;];][10:25:2009;03:28:2010;0;[1;02:00:00;10;25;];[1;01:59:59;3;28;];][03:28:2010;10:31:2010;60;[1;02:00:00;3;28;];[1;02:59:59;10;31;];][10:31:2010;03:27:2011;0;[1;02:00:00;10;31;];[1;01:59:59;3;27;];][03:27:2011;10:30:2011;60;[1;02:00:00;3;27;];[1;02:59:59;10;30;];][10:30:2011;03:25:2012;0;[1;02:00:00;10;30;];[1;01:59:59;3;25;];][03:25:2012;10:28:2012;60;[1;02:00:00;3;25;];[1;02:59:59;10;28;];][10:28:2012;03:31:2013;0;[1;02:00:00;10;28;];[1;01:59:59;3;31;];][03:31:2013;10:27:2013;60;[1;02:00:00;3;31;];[1;02:59:59;10;27;];][10:27:2013;03:30:2014;0;[1;02:00:00;10;27;];[1;01:59:59;3;30;];][03:30:2014;10:26:2014;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:2014;03:29:2015;0;[1;02:00:00;10;26;];[1;01:59:59;3;29;];][03:29:2015;10:25:2015;60;[1;02:00:00;3;29;];[1;02:59:59;10;25;];][10:25:2015;03:27:2016;0;[1;02:00:00;10;25;];[1;01:59:59;3;27;];][03:27:2016;10:30:2016;60;[1;02:00:00;3;27;];[1;02:59:59;10;30;];][10:30:2016;03:26:2017;0;[1;02:00:00;10;30;];[1;01:59:59;3;26;];][03:26:2017;10:29:2017;60;[1;02:00:00;3;26;];[1;02:59:59;10;29;];][10:29:2017;03:25:2018;0;[1;02:00:00;10;29;];[1;01:59:59;3;25;];][03:25:2018;10:28:2018;60;[1;02:00:00;3;25;];[1;02:59:59;10;28;];][10:28:2018;03:31:2019;0;[1;02:00:00;10;28;];[1;01:59:59;3;31;];][03:31:2019;10:27:2019;60;[1;02:00:00;3;31;];[1;02:59:59;10;27;];][10:27:2019;03:29:2020;0;[1;02:00:00;10;27;];[1;01:59:59;3;29;];][03:29:2020;10:25:2020;60;[1;02:00:00;3;29;];[1;02:59:59;10;25;];][10:25:2020;03:28:2021;0;[1;02:00:00;10;25;];[1;01:59:59;3;28;];][03:28:2021;10:31:2021;60;[1;02:00:00;3;28;];[1;02:59:59;10;31;];][10:31:2021;03:27:2022;0;[1;02:00:00;10;31;];[1;01:59:59;3;27;];][03:27:2022;10:30:2022;60;[1;02:00:00;3;27;];[1;02:59:59;10;30;];][10:30:2022;03:26:2023;0;[1;02:00:00;10;30;];[1;01:59:59;3;26;];][03:26:2023;10:29:2023;60;[1;02:00:00;3;26;];[1;02:59:59;10;29;];][10:29:2023;03:31:2024;0;[1;02:00:00;10;29;];[1;01:59:59;3;31;];][03:31:2024;10:27:2024;60;[1;02:00:00;3;31;];[1;02:59:59;10;27;];][10:27:2024;03:30:2025;0;[1;02:00:00;10;27;];[1;01:59:59;3;30;];][03:30:2025;10:26:2025;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:2025;03:29:2026;0;[1;02:00:00;10;26;];[1;01:59:59;3;29;];][03:29:2026;10:25:2026;60;[1;02:00:00;3;29;];[1;02:59:59;10;25;];][10:25:2026;03:28:2027;0;[1;02:00:00;10;25;];[1;01:59:59;3;28;];][03:28:2027;10:31:2027;60;[1;02:00:00;3;28;];[1;02:59:59;10;31;];][10:31:2027;03:26:2028;0;[1;02:00:00;10;31;];[1;01:59:59;3;26;];][03:26:2028;10:29:2028;60;[1;02:00:00;3;26;];[1;02:59:59;10;29;];][10:29:2028;03:25:2029;0;[1;02:00:00;10;29;];[1;01:59:59;3;25;];][03:25:2029;10:28:2029;60;[1;02:00:00;3;25;];[1;02:59:59;10;28;];][10:28:2029;03:31:2030;0;[1;02:00:00;10;28;];[1;01:59:59;3;31;];][03:31:2030;10:27:2030;60;[1;02:00:00;3;31;];[1;02:59:59;10;27;];][10:27:2030;03:30:2031;0;[1;02:00:00;10;27;];[1;01:59:59;3;30;];][03:30:2031;10:26:2031;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:2031;03:28:2032;0;[1;02:00:00;10;26;];[1;01:59:59;3;28;];][03:28:2032;10:31:2032;60;[1;02:00:00;3;28;];[1;02:59:59;10;31;];][10:31:2032;03:27:2033;0;[1;02:00:00;10;31;];[1;01:59:59;3;27;];][03:27:2033;10:30:2033;60;[1;02:00:00;3;27;];[1;02:59:59;10;30;];][10:30:2033;03:26:2034;0;[1;02:00:00;10;30;];[1;01:59:59;3;26;];][03:26:2034;10:29:2034;60;[1;02:00:00;3;26;];[1;02:59:59;10;29;];][10:29:2034;03:25:2035;0;[1;02:00:00;10;29;];[1;01:59:59;3;25;];][03:25:2035;10:28:2035;60;[1;02:00:00;3;25;];[1;02:59:59;10;28;];][10:28:2035;03:30:2036;0;[1;02:00:00;10;28;];[1;01:59:59;3;30;];][03:30:2036;10:26:2036;60;[1;02:00:00;3;30;];[1;02:59:59;10;26;];][10:26:2036;03:29:2037;0;[1;02:00:00;10;26;];[1;01:59:59;3;29;];][03:29:2037;10:25:2037;60;[1;02:00:00;3;29;];[1;02:59:59;10;25;];][10:25:2037;12:31:9999;60;[1;02:00:00;10;25;];[1;23:59:59;12;31;];];

However, this is the result on the same machine, when executed within the C# Interactive window:
"W. Europe Standard Time;60;(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna;W. Europe Standard Time;W. Europe Daylight Time;[01:01:0001;12:31:9999;60;[0;02:00:00;3;5;0;];[0;03:00:00;10;5;0;];];"

Exceptions (if any)

System.Runtime.Serialization.SerializationException: An error occurred while deserializing the object. The serialized data is corrupt. [...]

Further technical details

  • ASP.NET Core 5.0
  • Visual Studio Version 16.10.0 Preview 1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions