Bug Report T419166
Visible to All Users

NullReference exception is raised on executing the BestFit method

created 9 years ago (modified 9 years ago)

To replicate the issue, run the attached sample project and drag the Type field to the Row Area.

System.NullReferenceException was unhandled
  _HResult=-2147467261
  _message=Object reference not set to an instance of an object.
  HResult=-2147467261
  IsTransient=false
  Message=Object reference not set to an instance of an object.
  Source=DevExpress.Xpf.PivotGrid.v15.1
  StackTrace:
       at DevExpress.Xpf.PivotGrid.Internal.CellsAreaItem.get_IsTotalAppearance()
       at DevExpress.Xpf.PivotGrid.Internal.CellsAreaItem.get_ActualMode()
       at DevExpress.Xpf.PivotGrid.Internal.CellsAreaItem.GetActualBackgroundBrush()
       at DevExpress.Xpf.PivotGrid.Internal.CellsAreaItem.UpdateAppearance()
       at DevExpress.Xpf.PivotGrid.Internal.CellsAreaItem…ctor(PivotVisualItems visualItems, Int32 columnIndex, Int32 rowIndex)
       at DevExpress.Xpf.PivotGrid.Internal.BestWidthCalculator.BestFitCacheHelper.GetCellSize(FrameworkElement bestFitControl, BestWidthCalculator calculator, IBestFitColumn column, Int32 rowHandle)
       at DevExpress.Xpf.PivotGrid.Internal.BestWidthCalculator.RowsBestFitCalculator.CalcRowsBestFit(FrameworkElement bestFitControl, IBestFitColumn column, Double& result)
       at DevExpress.Xpf.Core.Native.BestFitCalculatorBase.CalcDataBestFit(IBestFitColumn column, Double& result)
       at DevExpress.Xpf.PivotGrid.Internal.BestWidthCalculator.CalcDataBestFitWidthsCore(BestFitResult bestFitResult)
       at DevExpress.Xpf.PivotGrid.Internal.BestWidthCalculator.CalcDataBestFitWidths(BestFitResult bestFitResult)
       at DevExpress.Xpf.PivotGrid.Internal.BestFitter.CalcDataBestWidths(BestFitResult bestFitResult)
       at DevExpress.Xpf.PivotGrid.Internal.BestFitter.SetColumnSizesCore(BestFitLevelFieldValues curColumn, BestFitResult bestFitResult)
       at DevExpress.Xpf.PivotGrid.Internal.BestFitter.BestFitColumns(Boolean fitWidth, Boolean fitHeight)
       at DevExpress.Xpf.PivotGrid.Internal.BestFitter.BestFit(FieldArea area, Boolean isTreeRowTotalsLocation, Boolean fitWidth, Boolean fitHeight)
       at DevExpress.Xpf.PivotGrid.Internal.BestFitter.BestFit(Boolean isTreeRowTotalsLocation, Boolean fitWidth, Boolean fitHeight)
       at DevExpress.Xpf.PivotGrid.PivotGridControl.BestFit(Boolean fitWidth, Boolean fitHeight)
       at DevExpress.Xpf.PivotGrid.PivotGridControl.BestFit()
       at WpfApplication53.MainWindow.pivotGridControl1BestFit() in c:\Work\Projects\WorkExamples\WpfApplication53\WpfApplication53\MainWindow.xaml.cs:line 89
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(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 MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       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 WpfApplication53.App.Main() in c:\Work\Projects\WorkExamples\WpfApplication53\WpfApplication53\obj\x86\Debug\App.g.cs:line 0
       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()
  InnerException:

Comments (2)
AA AA
Angshuman Agarwal 1 9 years ago

    No attached sample ?

    DevExpress Support Team 9 years ago

      Sorry, here is an example.

      Answers approved by DevExpress Support

      created 8 years ago

      We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

      Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.