Bugzilla – Bug 321473
[GMCS] cast from object to nullable type causes NullReferenceException
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by atsushi@ximian.com 2006-07-03 10:47:21 MST ---- The following code when compiled with gmcs causes NullReferenceException, while with csc it does not. -------- using System; public class Tset { public static void Main () { Foo (); } static object obj; static bool? Foo () { return (bool?) obj; } } Actual Results: mono ./nullable-cast.exe Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Tset.Foo () [0x00000] at Tset.Main () [0x00000] Expected Results: no error. How often does this happen? consistently. ---- Additional Comments From martin@ximian.com 2006-07-05 11:10:21 MST ---- Already fixed :-) Unknown operating system unknown. Setting to default OS "Other".