Hi, i'm using the ultradayview (v8 with last hotfix) and i getting a null-exception and didnt know the reason.
All appointments will be loaded into a ultracalendarinfo. In 30sec intervalls a timer clears all appointments and load them again.
This error comes not everytime and i can not reproduce it on my develop-machine. It occurs on customer-side after some time.
Here the first errormsg:
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei Infragistics.Win.UltraWinSchedule.AppointmentsCollection.GetStartIndexForDate(DateTime subsetStartDateTime) bei Infragistics.Win.UltraWinSchedule.AppointmentsCollection.PopulateSubsetListHelper(Owner[ owners, ArrayList subSetList, DateTime subsetStartDateTime, DateTime subsetEndDateTime) bei Infragistics.Win.UltraWinSchedule.AppointmentsSubsetCollection.VerifyCollectionIsUpToDate() bei Infragistics.Win.UltraWinSchedule.AppointmentsSubsetCollection.GetEnumerator() bei Infragistics.Win.UltraWinSchedule.AllDayEventManager.RebuildAllDayEventInfo() bei Infragistics.Win.UltraWinSchedule.AllDayEventManager.get_AllDayEventAreaHeight() bei Infragistics.Win.UltraWinSchedule.UltraDayView.get_HeadingAreaHeight() bei Infragistics.Win.UltraWinSchedule.TimeSlotDescriptorAreaMetrics.VerifyHeight() bei Infragistics.Win.UltraWinSchedule.UltraDayView.get_TotalVisibleTimeSlots() bei Infragistics.Win.UltraWinSchedule.UltraDayView.get_NeedTimeSlotScrollBar() bei Infragistics.Win.UltraWinSchedule.UltraDayView.ConfigureTimeSlotScrollBar() bei Infragistics.Win.UltraWinSchedule.UltraDayView.get_ScrollBarWidth() bei Infragistics.Win.UltraWinSchedule.UltraDayView.get_DayAreaWidth() bei Infragistics.Win.UltraWinSchedule.UltraDayView.GetInViewColumnCount(Int32 preferredColWidth) bei Infragistics.Win.UltraWinSchedule.UltraDayView.get_InViewColumnCount() bei Infragistics.Win.UltraWinSchedule.InViewColumnsCollection.SynchronizeCount() bei Infragistics.Win.UltraWinSchedule.InViewColumnsCollection.GetItem(Int32 index) bei Infragistics.Win.UltraWinSchedule.InViewColumnsCollection.get_Item(Int32 index) bei Infragistics.Win.UltraWinSchedule.DayView.DayAreaUIElement.PositionChildElements() bei Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) bei Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive) bei Infragistics.Win.UIElement.VerifyChildElements() bei Infragistics.Win.UltraWinSchedule.DayView.GroupUIElement.PositionChildElements() bei Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) bei Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive) bei Infragistics.Win.UIElement.VerifyChildElements() bei Infragistics.Win.UltraWinSchedule.DayView.MainUIElement.AddGroupElement(UIElementsCollection oldElements, Int32 firstColumnIndex, Rectangle groupRect) bei Infragistics.Win.UltraWinSchedule.DayView.MainUIElement.PositionChildElements() bei Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) bei Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) bei Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics) bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics) bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) bei Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe) bei Infragistics.Win.UltraWinSchedule.UltraScheduleControlBase.OnPaint(PaintEventArgs pe) bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) bei System.Windows.Forms.Control.WmPaint(Message& m) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
That comes after..
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei Infragistics.Win.UltraWinSchedule.AppointmentsCollection.ClearHelper(Boolean removeFromDataSource) bei Infragistics.Win.UltraWinSchedule.AppointmentsDataBinding.OnDataSourceRemoved() bei Infragistics.Win.UltraWinSchedule.DataBindingsBase.SetDataBindingHelper() bei Infragistics.Win.UltraWinSchedule.DataBindingsBase.SetDataBinding(Object dataSource, String dataMember) bei Infragistics.Win.UltraWinSchedule.UltraCalendarInfo.Dispose(Boolean disposing) bei System.ComponentModel.Component.Dispose() bei System.ComponentModel.Container.Dispose(Boolean disposing) bei System.ComponentModel.Container.Dispose() bei Berlin.ctlTerminuebersicht.Dispose(Boolean disposing) in C:\Users\Miki\Documents\Visual Studio 2005\Projects\Berlin\Berlin\Usercontrols\ctlTerminuebersicht.Designer.vb:Zeile 9. bei System.ComponentModel.Component.Dispose() bei System.Windows.Forms.Control.Dispose(Boolean disposing) bei System.ComponentModel.Component.Dispose() bei System.Windows.Forms.Control.Dispose(Boolean disposing) bei System.Windows.Forms.ContainerControl.Dispose(Boolean disposing) bei System.Windows.Forms.Form.Dispose(Boolean disposing) bei KÖ_Berlin.Form1.Dispose(Boolean disposing) in C:\Users\Miki\Documents\Visual Studio 2005\Projects\Berlin\Berlin\Form1.Designer.vb:Zeile 11. bei System.ComponentModel.Component.Dispose() bei System.Windows.Forms.Form.WmClose(Message& m) bei System.Windows.Forms.Form.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Currently i have no idea, why this error occures, but it seems that somthing happens to the AppointmentsCollection...
Thanks...
I took a look at the GetStartIndexForDate method implementation, and I didn't see anything obvious...you mentioned that "...a timer clears all appointments and load them again"; if this is being done using multi-threading, it is possible you are not marshalling the call across thread boundaries correctly.
Hi Brian,
thanks for your reply. This could be possible. I have a CalendarInfo and Dayview Control on the form. The process to load the appointments from database and populate the calendarInfo is called "loadAppointments". In this method i clear all appointments, loading them from the database and populate the calendarinfo again. This method is called by a backgroundworker. Can you explain how to make sure that this work. Currently I'm not sure how to proceed.
Thanks!
That was it! Thanks a lot!
If you are repopulating the database in reponse to the BackgroundWorker's DoWork event (which is raised when the RunWorkerAsync method is called), you should not be changing the contents of the Appointments collection therein as you should not be manipulating any user interface objects from that event. You should probably use eiter ProgressChanged or RunWorkerCompleted.
i will take a look at the databinding. Thank you.
But maybe it is related to the backgroundworker. When i start the RunWorkerAsync method and give the calendarinfo with it. E.g. Me.BackgroundWorker1.RunWorkerAsync(UltraCalendarInfo1)
But the Dayview is bound to the Calendarinfo. So could this be causing the error?
Thanks
The BackgroundWorker was designed to make marshalling across thread boundaries easier, so it might not be that after all. It is dificult to speculate about this without more details about the implementation, but you might want to use WInSchedule's intrinsic data binding support instead; see the UltraCalendarInfo's AppointmentsDataBinding property.