Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
NullReferenceException when the app closed
posted

Hello,

I use XamDataGrid (XDG) in my project. Many XDDG are in the TabItemEx.

I have a NullReferenceException in PresentationFramework when i set the sorted description of the XDG (XAML or in code behind). The exception is thrown when i close the app.

I use PRISM and MVVM pattern in my project

The stackTrace:

at System.Windows.Data.BindingExpression.Deactivate()
   at System.Windows.Data.BindingExpression.DetachOverride()
   at System.Windows.Data.BindingExpressionBase.Detach()
   at System.Windows.Data.BindingExpressionBase.OnDetach(DependencyObject d, DependencyProperty dp)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at System.Windows.UIElement.set_Visibility(Visibility value)
   at Infragistics.Windows.DataPresenter.Internal.TemplateDataRecordCache.InitializeCachedCellArea()
   at Infragistics.Windows.DataPresenter.Internal.TemplateDataRecordCache.VerifyCache()
   at Infragistics.Windows.DataPresenter.Internal.TemplateDataRecordCache.GetCellValuePresenter(Field field, Boolean createIfNull)
   at Infragistics.Windows.DataPresenter.CellTextConverterInfo..ctor(Field field)
   at Infragistics.Windows.DataPresenter.CellTextConverterInfo.GetCachedConverter(Field field)
   at Infragistics.Windows.DataPresenter.RecordManager.SameFieldRecordsSortComparer.FieldSortInfo.Initialize(FieldSortDescription fieldSortDescription, SameFieldRecordsSortComparer comparerInfo, FieldLayout fieldLayout)
   at Infragistics.Windows.DataPresenter.RecordManager.SameFieldRecordsSortComparer.FieldSortInfo..ctor(FieldSortDescription fieldSortDescription, SameFieldRecordsSortComparer comparerInfo, FieldLayout fieldLayout)
   at Infragistics.Windows.DataPresenter.RecordManager.SameFieldRecordsSortComparer..ctor(FieldLayout fieldLayout, Int32 recordsBeingSortedCount, Boolean areRecordsInUnsortedOrder)
   at Infragistics.Windows.DataPresenter.RecordManager.SortHelper(Record[] records, Boolean hasGroupByFields, Boolean& hasMultipleFieldLayouts, Boolean areRecordsInUnsortedOrder)
   at Infragistics.Windows.DataPresenter.RecordManager.VerifySort()
   at Infragistics.Windows.DataPresenter.RecordManager.OnSourceCollectionReset()
   at Infragistics.Windows.DataPresenter.RecordManager.PostDelayedReset()
   at Infragistics.Windows.DataPresenter.RecordManager.SetDataSource(IEnumerable currentValue, Boolean postReset)
   at Infragistics.Windows.DataPresenter.RecordManager.set_DataSource(IEnumerable value)
   at Infragistics.Windows.DataPresenter.DataPresenterBase.VerifyRecordManagerDataSource()
   at Infragistics.Windows.DataPresenter.RecordManager.VerifyRootDataSource()
   at Infragistics.Windows.DataPresenter.RecordManager.get_Sorted()
   at Infragistics.Windows.DataPresenter.FilteredDataItemsCollection.HookUnhookRecordManager(Boolean unhook)
   at Infragistics.Windows.DataPresenter.FilteredDataItemsCollection.OnHasListenersChanged()
   at Infragistics.Windows.DataPresenter.FilteredDataItemsCollection.remove_PropertyChanged(PropertyChangedEventHandler value)
   at System.ComponentModel.PropertyChangedEventManager.StopListening(Object source)
   at System.ComponentModel.PropertyChangedEventManager.Purge(Object source, Object data, Boolean purgeAll)
   at MS.Internal.WeakEventTable.Purge(Boolean purgeAll)
   at MS.Internal.WeakEventTable.WeakEventTableShutDownListener.OnShutDown(Object target, Object sender, EventArgs e)
   at MS.Internal.ShutDownListener.HandleShutDown(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Threading.Dispatcher.ShutdownImplInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.Dispatcher.ShutdownImpl()
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at Sample.App.Main() in c:\Users\XXXXXX\XXXXXXXXXXXXXXXXXXXXXXXXXX\Sample\Sample\obj\Release\App.g.cs:line 54
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

The behavior is strange....

Any suggestion would be appreciated. Thanks.

I attach a sample project to describe this behavior.

Sample2.zip
Parents Reply Children