Skip to content

Windows Server 2016 - The type initializer for 'TimeZoneNames.TZNames' threw an exception. #65

@akirby

Description

@akirby

I have the following implementation in .NET Framework 4.7.1

var tzNames = TZNames.GetAbbreviationsForTimeZone(tz.Id, CultureInfo.CurrentCulture.Name);

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

LCID             Name             DisplayName
----             ----             -----------
1033             en-US            English (United States)

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.

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions