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

Mac Catalyst: TimeZoneInfo.FindSystemTimeZoneById fails #55941

Closed
rolfbjarne opened this issue Jul 19, 2021 · 5 comments
Closed

Mac Catalyst: TimeZoneInfo.FindSystemTimeZoneById fails #55941

rolfbjarne opened this issue Jul 19, 2021 · 5 comments
Assignees
Milestone

Comments

@rolfbjarne
Copy link
Member

Description

Most (all?) calls to TimeZoneInfo.FindSystemTimeZoneById ("X") fails with:

The time zone ID 'X' was found on the local computer, but the file at '/usr/share/zoneinfo/X' was corrupt.

List of IDs that fail on our tests: https://gist.github.com/rolfbjarne/a0c8be26fa30774ed37892d7af4ecd2e

This only seems to happen with Mac Catalyst, none of the other Apple platforms.

It's a regression, that happened sometime between 6.0.100-preview.7.21330.1 and 6.0.100-rc.1.21369.3

Ref: xamarin/xamarin-macios#12064

The test that fails: https:/xamarin/xamarin-macios/blob/b4dcee199b30877b1f0e24974ea4e7404e1527db/tests/monotouch-test/Foundation/NSTimeZoneTest.cs#L53

CC @steveisok

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Globalization untriaged New issue has not been triaged by the area owner labels Jul 19, 2021
@ghost
Copy link

ghost commented Jul 19, 2021

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

Issue Details

Description

Most (all?) calls to TimeZoneInfo.FindSystemTimeZoneById ("X") fails with:

The time zone ID 'X' was found on the local computer, but the file at '/usr/share/zoneinfo/X' was corrupt.

List of IDs that fail on our tests: https://gist.github.com/rolfbjarne/a0c8be26fa30774ed37892d7af4ecd2e

This only seems to happen with Mac Catalyst, none of the other Apple platforms.

It's a regression, that happened sometime between 6.0.100-preview.7.21330.1 and 6.0.100-rc.1.21369.3

Ref: xamarin/xamarin-macios#12064

The test that fails: https:/xamarin/xamarin-macios/blob/b4dcee199b30877b1f0e24974ea4e7404e1527db/tests/monotouch-test/Foundation/NSTimeZoneTest.cs#L53

CC @steveisok

Author: rolfbjarne
Assignees: -
Labels:

area-System.Globalization, untriaged

Milestone: -

@tarekgh tarekgh added area-System.Runtime and removed area-System.Globalization untriaged New issue has not been triaged by the area owner labels Jul 19, 2021
@ghost
Copy link

ghost commented Jul 19, 2021

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Most (all?) calls to TimeZoneInfo.FindSystemTimeZoneById ("X") fails with:

The time zone ID 'X' was found on the local computer, but the file at '/usr/share/zoneinfo/X' was corrupt.

List of IDs that fail on our tests: https://gist.github.com/rolfbjarne/a0c8be26fa30774ed37892d7af4ecd2e

This only seems to happen with Mac Catalyst, none of the other Apple platforms.

It's a regression, that happened sometime between 6.0.100-preview.7.21330.1 and 6.0.100-rc.1.21369.3

Ref: xamarin/xamarin-macios#12064

The test that fails: https:/xamarin/xamarin-macios/blob/b4dcee199b30877b1f0e24974ea4e7404e1527db/tests/monotouch-test/Foundation/NSTimeZoneTest.cs#L53

CC @steveisok

Author: rolfbjarne
Assignees: -
Labels:

area-System.Runtime

Milestone: -

@tarekgh tarekgh added the os-maccatalyst MacCatalyst OS label Jul 19, 2021
@tarekgh tarekgh added this to the 6.0.0 milestone Jul 19, 2021
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue Jul 20, 2021
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue Jul 20, 2021
@mdh1418
Copy link
Member

mdh1418 commented Jul 20, 2021

Using dotnet 6.0.100-rc.1.21370.1
This passes on dotnet/runtime

[Fact]
public static void All_28300()
{
    TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById ("Africa/Abidjan");
    Assert.NotNull(tzi);

    TimeSpan ts = tzi.GetUtcOffset(DateTime.Now);
    TimeSpan local = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now);
    Assert.Equal(ts, new TimeSpan(0, 0, 0));
    Assert.Equal(local, new TimeSpan(-4, 0, 0));
}

This is using macOS Big Sur Version 11.4

For what it's worth, I've seen that error message several times when implementing the parsing for #54845
Whenever the tzdata files were not parsed correctly, that error message The time zone ID 'X' was found on the local computer, but the file at '/usr/share/zoneinfo/X' was corrupt. was hit.

@mdh1418
Copy link
Member

mdh1418 commented Jul 26, 2021

@rolfbjarne Do you happen to have another repro for this error? The error message is from InvalidTimeZone_InvalidFileData and this is only called in TryGetTimeZoneFromLocalMachine at the time of the regression. Was there an inner exception logged as well?

@rolfbjarne
Copy link
Member Author

I traced exception in a test app, and got this:

$ MONO_TRACE=E:all /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/MacCatalyst/bin/Debug/net6.0-maccatalyst/maccatalyst-x64//MySimpleApp.app/Contents/MacOS/MySimpleApp
[...]

[0x116b6de00:] EXCEPTION handling: System.Globalization.CultureNotFoundException: Argument_CultureNotSupportedInInvariantMode Arg_ParamName_Name, name Argument_CultureInvalidIdentifier, en-us

"<unnamed thread>" tid=0x116b6de00 this=0x11295c130 , thread handle : 0x7fcfe97087b0, state : not waiting
  at System.Globalization.CultureInfo.GetCultureInfo (string) [0x0009f] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryPopulateTimeZoneDisplayNamesFromGlobalizationData (string,System.TimeSpan,string&,string&,string&) [0x00018] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo..ctor (byte[],string,bool) [0x00235] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.GetTimeZoneFromTzData (byte[],string) [0x00006] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine (string,System.TimeZoneInfo&,System.Exception&) [0x0005b] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine (string,bool,System.TimeZoneInfo&,System.Exception&,System.TimeZoneInfo/CachedData) [0x00004] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZoneUsingId (string,bool,System.TimeZoneInfo&,System.Exception&,System.TimeZoneInfo/CachedData,bool) [0x00094] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZone (string,bool,System.TimeZoneInfo&,System.Exception&,System.TimeZoneInfo/CachedData,bool) [0x00008] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.FindSystemTimeZoneById (string) [0x00061] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at MySimpleApp.Program.Main (string[]) [0x00022] in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:17
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00036] in <d5607b203eb54e56aba48c5bba09e8d2>:0

[0x116b6de00:] EXCEPTION handling: System.Globalization.CultureNotFoundException: Argument_CultureNotSupportedInInvariantMode Arg_ParamName_Name, name Argument_CultureInvalidIdentifier, en-us

"<unnamed thread>" tid=0x116b6de00 this=0x11295c130 , thread handle : 0x7fcfe97087b0, state : not waiting
  at System.Globalization.CultureInfo.GetCultureInfo (string) [0x0009f] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryPopulateTimeZoneDisplayNamesFromGlobalizationData (string,System.TimeSpan,string&,string&,string&) [0x00018] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo..ctor (byte[],string,bool) [0x00235] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.GetTimeZoneFromTzData (byte[],string) [0x00018] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine (string,System.TimeZoneInfo&,System.Exception&) [0x0005b] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine (string,bool,System.TimeZoneInfo&,System.Exception&,System.TimeZoneInfo/CachedData) [0x00004] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZoneUsingId (string,bool,System.TimeZoneInfo&,System.Exception&,System.TimeZoneInfo/CachedData,bool) [0x00094] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.TryGetTimeZone (string,bool,System.TimeZoneInfo&,System.Exception&,System.TimeZoneInfo/CachedData,bool) [0x00008] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at System.TimeZoneInfo.FindSystemTimeZoneById (string) [0x00061] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at MySimpleApp.Program.Main (string[]) [0x00022] in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:17
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00036] in <d5607b203eb54e56aba48c5bba09e8d2>:0

[0x116b6de00:] EXCEPTION handling: System.InvalidTimeZoneException: InvalidTimeZone_InvalidFileData, Africa/Abidjan, /usr/share/zoneinfo/Africa/Abidjan

"<unnamed thread>" tid=0x116b6de00 this=0x11295c130 , thread handle : 0x7fcfe97087b0, state : not waiting
  at System.TimeZoneInfo.FindSystemTimeZoneById (string) [0x000a8] in <0f8c6ee5cdad4e2785c5d2d9bfe34bca>:0
  at MySimpleApp.Program.Main (string[]) [0x00022] in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:17
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00036] in <d5607b203eb54e56aba48c5bba09e8d2>:0

System.InvalidTimeZoneException: InvalidTimeZone_InvalidFileData, Africa/Abidjan, /usr/share/zoneinfo/Africa/Abidjan
   at System.TimeZoneInfo.FindSystemTimeZoneById(String id) in System.Private.CoreLib.dll:token 0x6001beb+0x7e
   at MySimpleApp.Program.Main(String[] args) in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:line 17

The Argument_CultureNotSupportedInInvariantMode clearly means this is another manifestation of xamarin/xamarin-macios#11392, where there's no globalization data for Mac Catalyst.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 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