public static class CoalescingWithGenericsBug { class Service { public void Foo () { } } static T Provide () where T : class { return FindExisting () ?? System.Activator.CreateInstance (); } static T FindExisting () where T : class { return null; } public static int Main () { Provide ().Foo (); return 0; } }