https://bugzilla.novell.com/show_bug.cgi?id=692444
https://bugzilla.novell.com/show_bug.cgi?id=692444#c0 Summary: GroupBy throws when accessing property for first time (MonoTouch 4.0.3) Classification: Mono Product: MonoTouch Version: unspecified Platform: iPhone OS/Version: Other Status: NEW Severity: Major Priority: P5 - None Component: Runtime AssignedTo: mono-bugs@lists.ximian.com ReportedBy: krisow+nov...@gmail.com QAContact: mono-bugs@lists.ximian.com Found By: Development Blocker: No Description of Problem: When I use GroupBy to group by a property that hasn't been accessed yet (even though the property is set at startup), a NullReferenceException is thrown. Steps to reproduce the problem: I have an object with a DateTime property. When I try to group by DateTime.Date, I get this exception. However, if I access the Date property prior to GroupBy, I don't get the exception. My GroupBy statement, which throws the exception: foreach(var dateGroup in DataStore.Instance.ClassItems.GroupBy(c => c.StartTime.Date)) However, if I add a no-op statement that accesses StartTime.Date prior to the GroupBy, no exception is thrown for the GroupBy: foreach(var classItem in DataStore.Instance.ClassItems) if(classItem.StartTime.Date == DateTime.Now) ... The DataStore is a singleton, and class items are currently mocked in the constructor: public class DataStore { private static readonly DataStore instance = new DataStore(); public static DataStore Instance { get { return instance; } } private DataStore() { this.ClassItems = new List<ClassItem>(); // Generate mock ClassItems } } Actual Results: System.NullReferenceException: Object reference not set to an instance of an object at Mono.Debugging.Client.ObjectValue.GetChild (System.String name) [0x00000] in <filename unknown>:0 at Mono.Debugging.Client.ExceptionStackFrame.get_File () [0x00000] in <filename unknown>:0 at MonoDevelop.Debugger.ExceptionCaughtDialog.ShowStackTrace (Mono.Debugging.Client.ExceptionInfo exc, Boolean showExceptionNode) [0x00000] in <filename unknown>:0 at MonoDevelop.Debugger.ExceptionCaughtDialog.Fill () [0x00000] in <filename unknown>:0 at MonoDevelop.Debugger.ExceptionCaughtDialog.<HandleExceptionChanged>m__0 (System.Object , System.EventArgs ) [0x00000] in <filename unknown>:0 at Gtk.Application+InvokeCB.Invoke () [0x00000] in <filename unknown>:0 at GLib.Timeout+TimeoutProxy.Handler () [0x00000] in <filename unknown>:0 Expected Results: No exception when property is non-null. How often does this happen? Always. Additional Information: -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs