Hello,
I am using the project attached on this page : http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
And when replacing the listView by your XamDataGrid I have a null referenceexception... Why ?
More ove, when the list is empty, it displays well the column names...
System.NullReferenceException was unhandled Message="La référence d'objet n'est pas définie à une instance d'un objet." Source="Infragistics3.Wpf.DataPresenter.v9.2" StackTrace: à Infragistics.Windows.Automation.Peers.DataPresenter.ViewableRecordCollectionAutomationPeer.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) à Infragistics.Windows.DataPresenter.ViewableRecordCollection.RaiseCollectionChanged(NotifyCollectionChangedEventArgs args) à Infragistics.Windows.DataPresenter.ViewableRecordCollection.RaiseChangeEvents(NotifyCollectionChangedEventArgs args) à Infragistics.Windows.DataPresenter.RecordManager.BeginUpdateInformation.ProcessPendingNotifications() à Infragistics.Windows.DataPresenter.ViewableRecordCollection.EnsureFiltersEvaluated() à Infragistics.Windows.DataPresenter.ViewableRecordCollection.Verify() à Infragistics.Windows.DataPresenter.ViewableRecordCollection.get_Count() à Infragistics.Windows.Automation.Peers.DataPresenter.ListAutomationPeerHelper..ctor(IRecordListAutomationPeer recordListAutomationPeer, IListAutomationPeer listAutomationPeer) à Infragistics.Windows.Automation.Peers.DataPresenter.ViewableRecordCollectionAutomationPeer..ctor(RecordListControl recordListControl, ViewableRecordCollection viewableRecordCollection, Boolean isRootLevel) à Infragistics.Windows.DataPresenter.RecordListControl.OnCreateAutomationPeer() à System.Windows.UIElement.CreateAutomationPeer() à System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) à System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) à System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) à System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) à System.Windows.Automation.Peers.UIElementAutomationPeer.GetChildrenCore() à System.Windows.Automation.Peers.AutomationPeer.EnsureChildren() à System.Windows.Automation.Peers.AutomationPeer.UpdateChildren() à System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() à System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() à System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() à System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() à System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() à System.Windows.ContextLayoutManager.fireAutomationEvents() à System.Windows.ContextLayoutManager.UpdateLayout() à System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg) à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks() à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) à System.Windows.Threading.DispatcherOperation.InvokeImpl() à System.Threading.ExecutionContext.runTryCode(Object userData) à System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) à System.Windows.Threading.DispatcherOperation.Invoke() à System.Windows.Threading.Dispatcher.ProcessQueue() à System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) à System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) à MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) à MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) à System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg) à System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) à System.Windows.Application.RunInternal(Window window) à DemoApp.App.Main() dans D:\Dev\External\MvvmDemoApp\MvvmDemoApp\DemoApp\obj\Release\App.g.cs:ligne 0 à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) à System.Threading.ThreadHelper.ThreadStart() InnerException:
having the same problem
Did anyone find a solution
System.NullReferenceException was unhandled by user code Message=Object reference not set to an instance of an object. Source=InfragisticsWPF4.DataPresenter.v10.3 StackTrace: at Infragistics.Windows.Automation.Peers.DataPresenter.ViewableRecordCollectionAutomationPeer.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) at Infragistics.Windows.DataPresenter.ViewableRecordCollection.RaiseCollectionChanged(NotifyCollectionChangedEventArgs args) at Infragistics.Windows.DataPresenter.ViewableRecordCollection.RaiseChangeEvents(NotifyCollectionChangedEventArgs args) at Infragistics.Windows.DataPresenter.RecordManager.BeginUpdateInformation.ProcessPendingNotifications() at Infragistics.Windows.DataPresenter.RecordManager.EndUpdate(Boolean dirtyScrollCount) at Infragistics.Windows.DataPresenter.ViewableRecordCollection.EnsureFiltersEvaluated() at Infragistics.Windows.DataPresenter.ViewableRecordCollection.Verify() at Infragistics.Windows.DataPresenter.ViewableRecordCollection.get_Count() at Infragistics.Windows.Automation.Peers.DataPresenter.ListAutomationPeerHelper..ctor(IRecordListAutomationPeer recordListAutomationPeer, IListAutomationPeer listAutomationPeer) at Infragistics.Windows.Automation.Peers.DataPresenter.ViewableRecordCollectionAutomationPeer..ctor(RecordListControl recordListControl, ViewableRecordCollection viewableRecordCollection, Boolean isRootLevel) at Infragistics.Windows.DataPresenter.RecordListControl.OnCreateAutomationPeer() at System.Windows.UIElement.CreateAutomationPeer() at System.Windows.Automation.Peers.UIElementAutomationPeer.CreatePeerForElement(UIElement element) at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) at System.Windows.Automation.Peers.UIElementAutomationPeer.iterate(DependencyObject parent, IteratorCallback callback) at System.Windows.Automation.Peers.UIElementAutomationPeer.GetChildrenCore() at System.Windows.Automation.Peers.AutomationPeer.EnsureChildren() at System.Windows.Automation.Peers.AutomationPeer.UpdateChildrenInternal(Int32 invalidateLimit) at System.Windows.Automation.Peers.AutomationPeer.UpdateChildren() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree() at System.Windows.ContextLayoutManager.fireAutomationEvents() at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.UIElement.UpdateLayout()
Alex,
This appears to be an old thread, with no movment in some time, but i am also experiencing what appears to be the same issue. I am binding to an Observable collection and getting the same exception and call stack. The grid functions correctly after the exception, to trouble shoot i have replaced the grid with a standard windows grid, which functions correctly. I've removed all settings from the grid, I've set the grid to only use a single column, I've replaced the binding property with a List insted of an observable collection. I have built the project and run it on a few PCs, and my troubles also appear only to occur on a small number of PCs. The only notable corrilation was that faster PCs seemed more prone to the problem, but the number i was able to run tests on was very small.
After creating a new project i have managed to reproduce the issue and it appears to only occur when a datagrid is placed on a tab control and loaded as a resource.
For Example the following xaml will run correctly:
<Grid><!--Row And ColumnDefinitions removed to save space--> <ComboBox ItemsSource="{Binding Types}" SelectedItem="{Binding Type}" DisplayMemberPath="Key" VerticalAlignment="Top"/> <ContentPresenter Grid.Row="1" Grid.ColumnSpan="2" Content="{Binding TypeDetail}"> <ContentPresenter.Resources> <DataTemplate DataType="{x:Type ToDisplay:Type1}"> <igWindows:XamTabControl> <igWindows:XamTabControl.Resources> </igWindows:XamTabControl.Resources> <igWindows:TabItemEx Header="Tab1"> <igDP:XamDataGrid DataSource="{Binding Path='MyData.Collection1'}"/> </igWindows:TabItemEx> <igWindows:TabItemEx Header="Tab2"> <igDP:XamDataGrid DataSource="{Binding Path='MyData.Collection2'}"/> </igWindows:TabItemEx> </igWindows:XamTabControl> </DataTemplate> </ContentPresenter.Resources> </ContentPresenter> </Grid>
The following xaml will on some machines throw the exception in question:
<Grid><!--Row And ColumnDefinitions removed to save space--> <ComboBox ItemsSource="{Binding Types}" SelectedItem="{Binding Type}" DisplayMemberPath="Key" VerticalAlignment="Top"/> <ContentPresenter Grid.Row="1" Grid.ColumnSpan="2" Content="{Binding TypeDetail}"> <ContentPresenter.Resources> <DataTemplate DataType="{x:Type ToDisplay:Type1}"> <igWindows:XamTabControl> <igWindows:XamTabControl.Resources> <igDP:XamDataGrid x:Key="Collection1" DataSource="{Binding Path='MyData.Collection1'}"/> <igDP:XamDataGrid x:Key="Collection2" DataSource="{Binding Path='MyData.Collection2'}"/> </igWindows:XamTabControl.Resources> <igWindows:TabItemEx Header="Tab1" Content="{StaticResource Collection1}"/> <igWindows:TabItemEx Header="Tab2" Content="{StaticResource Collection2}"/> </igWindows:XamTabControl> </DataTemplate> </ContentPresenter.Resources> </ContentPresenter> </Grid>
One final note which may help is that only the selected tab needs to have its content set directly for example this would work fine as long as the first tab is selected:
<igWindows:XamTabControl> <igWindows:XamTabControl.Resources> <igDP:XamDataGrid x:Key="Collection2" DataSource="{Binding Path='MyData.Collection2'}"/> <igDP:XamDataGrid x:Key="Collection3" DataSource="{Binding Path='MyData.Collection3'}"/> </igWindows:XamTabControl.Resources> <igWindows:TabItemEx Header="Tab1" Content="{StaticResource Collection1}"/> <igWindows:TabItemEx Header="Tab2"> <igDP:XamDataGrid DataSource="{Binding Path='MyData.Collection2'}"/> </igWindows:TabItemEx> <igWindows:TabItemEx Header="Tab3"> <igDP:XamDataGrid DataSource="{Binding Path='MyData.Collection3'}"/> </igWindows:TabItemEx> </igWindows:XamTabControl>
I'd like to offer any help you need in tracking down the cause of this issue, please feel free to contact me if you require any more information.
HI Alex,
We are currently experiencing the this exact same NullReferenceExeception (with the same stack trace), similar to the original post, I can't provide any further information because on most of our machines everything works fine, but on a small handful (about 3) we are consistently receiving this exception in several places.
I haven't been able to isolate any environmental differences that can explain this, and hence cannot provide any tips on how to reproduce this. Access to the .pdb files could help me troubleshoot this further.
Any help or information regarding this would be greatly appreciated.
Regards,
Liam
I was not able to reproduce this issue. I am testing this against the latest service release for 9.2 under Windows 7. Can you please give us more details on your environment