Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone convert back and forth on linux is not working #51970

Closed
tire0011 opened this issue Apr 28, 2021 · 4 comments
Closed

Timezone convert back and forth on linux is not working #51970

tire0011 opened this issue Apr 28, 2021 · 4 comments

Comments

@tire0011
Copy link

tire0011 commented Apr 28, 2021

Description

When I run this code snippet:
TimeZoneInfo.FromSerializedString(TimeZoneInfo.Local.ToSerializedString())
or on powershell core
[TimeZoneInfo]::FromSerializedString([TimeZoneInfo]::Local.ToSerializedString())
then a exception is thrown
"An error occurred while deserializing the object. The serialized data is corrupt."

Configuration

  • Which version of .NET is the code running on?
    dotnet --info

Host (useful for support):
Version: 5.0.0
Commit: cf258a1

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Regression?

Other information

  • Please include any relevant stack traces or error messages. If possible please include text as text rather than images (so it shows up in searches).
  • If you have an idea where the problem might lie, let us know that here. Please include any pointers to code, relevant changes, or related issues you know of.
  • Do you know of any workarounds?
    If I remove the Enviroment var TZ=Europe/Berlin, default is Etc/UTC then it is working.
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 28, 2021
@ghost
Copy link

ghost commented Apr 29, 2021

Tagging subscribers to this area: @tarekgh, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

When I run this code snippet:
TimeZoneInfo.FromSerializedString(TimeZoneInfo.Local.ToSerializedString())
or on powershell core
[TimeZoneInfo]::FromSerializedString([TimeZoneInfo]::Local.ToSerializedString())
then a exception is thrown
"An error occurred while deserializing the object. The serialized data is corrupt."

Configuration

  • Which version of .NET is the code running on?
    dotnet --info

Host (useful for support):
Version: 5.0.0
Commit: cf258a1

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Regression?

Other information

  • Please include any relevant stack traces or error messages. If possible please include text as text rather than images (so it shows up in searches).
  • If you have an idea where the problem might lie, let us know that here. Please include any pointers to code, relevant changes, or related issues you know of.
  • Do you know of any workarounds?
    If I remove the Enviroment var TZ=Europe/Berlin, default is Etc/UTC then it is working.
Author: tire0011
Assignees: -
Labels:

area-System.Globalization, untriaged

Milestone: -

@ghost
Copy link

ghost commented Apr 29, 2021

Tagging subscribers to this area: @tannergooding
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

When I run this code snippet:
TimeZoneInfo.FromSerializedString(TimeZoneInfo.Local.ToSerializedString())
or on powershell core
[TimeZoneInfo]::FromSerializedString([TimeZoneInfo]::Local.ToSerializedString())
then a exception is thrown
"An error occurred while deserializing the object. The serialized data is corrupt."

Configuration

  • Which version of .NET is the code running on?
    dotnet --info

Host (useful for support):
Version: 5.0.0
Commit: cf258a1

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Regression?

Other information

  • Please include any relevant stack traces or error messages. If possible please include text as text rather than images (so it shows up in searches).
  • If you have an idea where the problem might lie, let us know that here. Please include any pointers to code, relevant changes, or related issues you know of.
  • Do you know of any workarounds?
    If I remove the Enviroment var TZ=Europe/Berlin, default is Etc/UTC then it is working.
Author: tire0011
Assignees: -
Labels:

area-System.Runtime, untriaged

Milestone: -

@tarekgh tarekgh removed the untriaged New issue has not been triaged by the area owner label Apr 29, 2021
@tarekgh
Copy link
Member

tarekgh commented Apr 29, 2021

This is a duplicate of #19794

We are not recommending using FromSerializedString anymore and we are thinking to obsolete it. Now there are standard time zones which covering the entire world. so, you can just serialize only the time zone id and then reconstruct this time zone using this id when you want to deserialize it.

@tarekgh tarekgh closed this as completed Apr 29, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants