Hi,
In our released application we use an UltraGrid. This is in use by ~200 people across the company. On one particular machine there is a problem creating the ultragrid as shown by the exception below:
Does anyone have any ideas as to the possible causes of this, this is the only machine where this problem is manifesting itself.
The machine is running Windows XP SP2 and has .NET 3.5 SP1 runtime installed on it.
Thanks
Chris
===exception===System.NullReferenceExceptionObject reference not set to an instance of an object.===callstack=== at Infragistics.Win.UltraWinGrid.ColumnHeader.InitSynchronization() at Infragistics.Win.UltraWinGrid.UltraGridBand.CalculateBandMetrics(UltraGridBand priorBand) at Infragistics.Win.UltraWinGrid.BandsCollection.CalculateBandMetrics(Int32 pass) at Infragistics.Win.UltraWinGrid.BandsCollection.CalculateBandMetrics() at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetricsHelper() at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetrics() at Infragistics.Win.UltraWinGrid.UltraGridLayout.ApplyLoadedBands() at Infragistics.Win.UltraWinGrid.UltraGridBase.VerifyDataSourceAttached() at Infragistics.Win.UltraWinGrid.UltraGridBase.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.UserControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
My first suspicion is that your application may be using multiple threads without marshalling to the UI thread all calls that might update the UI. Such issues are often intermittent. A machine with different capabilities may be more or less likely to encounter such issues when running the same program.
Can you please confirm if you're using mulitiple threads in your application? This includes a BackgroundWorker component or a System.Threading.Timer object, as well as explicitly-created threads.
Hi Sorry for the delay - I was on holiday last week and was catching up yesterday.
I have upgraded to the latest hotfix (8.3.20083.2039) and oddly the issue is now present on my development machine.
I have removed any background workers and any threading timers from the application and the problem still present. I am as confident as I can be that there are no additional threads created anywhere in the application that can affect any UI components.
If I set the VS debugger to break on exceptions then the following line causes a null reference exception:
_bugMainGrid.DisplayLayout.Bands[BugBand].Columns["Flag"].Header.VisiblePosition = 0;
at Infragistics.Win.UltraWinGrid.ColumnHeader.InitSynchronization() at Infragistics.Win.UltraWinGrid.UltraGridBand.CalculateBandMetrics(UltraGridBand priorBand) at Infragistics.Win.UltraWinGrid.BandsCollection.CalculateBandMetrics(Int32 pass) at Infragistics.Win.UltraWinGrid.BandsCollection.CalculateBandMetrics() at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetricsHelper() at Infragistics.Win.UltraWinGrid.ColScrollRegionsCollection.InitializeMetrics() at Infragistics.Win.UltraWinGrid.ColumnsCollection.RecalculateMetrics() at Infragistics.Win.UltraWinGrid.ColumnHeader.SetVisiblePosition(Int32 visiblePosition, Boolean raiseColPosChangedNotifications) at Infragistics.Win.UltraWinGrid.ColumnHeader.set_VisiblePosition(Int32 value) at EuroBrats.UI.BugsView.BugGrid.SetupDefaultColumnOrder() in C:\source\EuroBrats5\Eurobrats.UI.BugsView\BugGrid.cs:line 985
Without the break we get the exception I detailed in my first post.
If I bypass the code path that causes the second (VisiblePosition) exception then I receive another null reference exception in the InitializeRow event of the grid during the execution of a foreach loop that itterates over all the cells in the row:
at Infragistics.Win.UltraWinGrid.UltraGridColumn.get_Index() at Infragistics.Win.UltraWinGrid.CellsCollection.SynchronizeWithColumnsColection() at Infragistics.Win.UltraWinGrid.CellsCollection.GetEnumerator() at EuroBrats.UI.BugsView.BugGrid._bugMainGrid_InitializeRow(Object sender, InitializeRowEventArgs e) in C:\source\EuroBrats5\Eurobrats.UI.BugsView\BugGrid.cs:line 2354
This all leaves me fairly confused, it would seem from the above that the UltraGrids internal state is not as expected, but as to why I'm at something of a loss.
I have also been looking through the source for this hotfix and it is hard to see how Infragistics.Win.UltraWinGrid.ColumnHeader.InitSynchronization() can easilly throw a null reference exception.
ThanksChris Coleman
Hi Chris,
If this is not a threading issue, then I'm afraid I am at a loss.
Does the problem occur reliably? If so, perhaps you can create a small sample project demonstrating the exception and Submit an incident to Infragistics Developer Support so they can check it out.