3 // Regression test for bug #58888
5 public static class Program
7 public static int Main (string[] args
)
9 // calling delegate on extension method with null target is allowed
10 Func
<int> func
= null;
11 if (CallFunc(func
.CallFuncIfNotNull
) != 0)
14 // constructing delegate on instance method with null target should throw
18 GC
.KeepAlive((Action
)obj
.Func
);
20 catch (NullReferenceException
)
33 static int CallFunc(Func
<int> func
)
39 public static class FuncExtensions
41 public static int CallFuncIfNotNull(this Func
<int> func
)