runtime: TimeZoneInfo.FindSystemTimeZoneById throws TimeZoneNotFoundException

.NET Core exposes TimeZoneInfo.FindSystemTimeZoneById(string) (MSDN) which throws a TimeZoneNotFoundException.

But the exception can’t be caught because TimeZoneNotFoundException isn’t exposed in .NET Core. We should include the exception type in the System.Runtime contract alongside the API that throws it.

Repro:

using System;

public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine(TimeZoneInfo.FindSystemTimeZoneById("DoesNotExist").ToString());
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

I’ll cast my vote as a human that it’s not ok 😉