Open akirby opened 3 years ago
tz.Id verified through logging is "Eastern Standard Time".
The tz object is from TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
Nothing else should need to be installed. Could you please do some debugging on the application itself to see if "en-US"
is being passed for the language code?
I hit something similar a long time ago with #32, but that has been resolved.
Could you please provide the specific exception name and message? I only see the stack trace. Thanks.
(Also, you should probably be using the CurrentUICulture
instead of CurrentCulture
, though I doubt that is the cause of the exception.)
I had a similar issue, this test demonstrates it:
The call to TimeZoneInfo.FindSystemTimeZoneById
adds another entry to the list of windows time zones, which then causes ToDictionary
to throw an exception as it is the duplicate key (case differs).
@robin-salih-fluke that is interesting.
@mattjohnsonpint
Any chance this is fixed? I am experiencing the same exact issue: See stacktrace below. lean forDisplayNames) at TimeZoneNames.TZNames.GetTimeZonesForCountry(String countryCode, String languageCode, DateTimeOffset threshold) at BusinessLogic.Utils.TimeZones.TimeZonesByCountry(String countryCode, String language) at Events.Controllers.EventController.CountryTimeZones(String countryID)
Exception Message: The type initializer for 'TimeZoneNames.TZNames' threw an exception."
@akirby @robin-salih-fluke Have you resolved this issue?
I'll take another look. Thanks.
I have the following implementation in .NET Framework 4.7.1
which throws the following error with stack trace: The type initializer for 'TimeZoneNames.TZNames' threw an exception. at TimeZoneNames.TZNames.GetLanguageKey(String languageCode, Boolean forDisplayNames) at TimeZoneNames.TZNames.GetAbbreviationsForTimeZone(String timeZoneId, String languageCode)
I have run windows update to ensure that I am current, but not sure if i need to install some other dependency on the server.
Running Get-Culture on the box returns
I have also run txutil to update the Timezone registry, but not sure if this is the correct step.
Please let me know if there is something else I can check on my server, as this code works on my dev machine.