mattjohnsonpint/TimeZoneConverter

"South Sudan Standard Time" results in TimeZoneNotFoundException in .NET 6 Preview 3

zoinkydoink opened this issue · 4 comments

Just converted the following code to .NET 6 preview there and the following fails when it tries to convert one of the items gotten from .KnownWindowsTimeZoneIds


            var timezoneIds = TZConvert.KnownWindowsTimeZoneIds.ToList();
            foreach (var timezoneId in timezoneIds)
            {
                try
                {
                    Timezones.Add(TZConvert.GetTimeZoneInfo(timezoneId));

                }
                catch (Exception e)
                {
                   
                }
                
            }

Hi. This is a new time zone ID established in the latest Windows update. Perhaps you don't yet have the update installed on this machine?

Also, if you're targeting .NET 6, you might not need this library anymore. See my note in the readme.

We're seeing this issue with similar code as above on .net 48. Please let me know if I'm wrong but I think KB5000854 is still in preview and isn't widely installed.

Edit: Updating to 3.5.0 resolved the issue.

c4d5dff

Per the notes in the readme:

Additionally, this library does not attempt to determine if the time zone IDs provided are actually present on the computer where the code is running. It is assumed that the computer is kept current with time zone updates.

For example, if one attempts to convert Africa/Khartoum to a Windows time zone ID, they will get Sudan Standard Time. If it is then used on a Windows computer that does not yet have KB4051956 installed (which created this time zone), they will likely get a TimeZoneNotFoundException.

The same now applies for Africa/Juba / South Sudan Standard Time

If you have KB5000854 installed, use the latest 3.5.0. If you don't, stay with 3.4.0.

Sorry if this is painful, but such is the way with time zone updates. Not everyone gets them all at once.

Also see #96 that needed this new Windows zone to be supported.

In general, I try to add them as soon as they are released, regardless of how widely released they are.