Ticket T509071
Visible to All Users

NullReferenceException is thrown in the GetFontCacheByFont method

created 8 years ago

[DevExpress Support Team: CLONED FROM T311768: FontsCache might be sharing GDI resources between different threads]
I get almost the same error and callstack.

Code
System.NullReferenceException: Object reference not set to an instance of an object. at DevExpress.Utils.Text.FontsCache.GetFontCacheByFont(Graphics graphics, Font font) at DevExpress.Utils.Text.TextUtils.GetStringSize(Graphics g, String text, Font font, StringFormat stringFormat, Int32 maxWidth, Int32 maxHeight, IWordBreakProvider wordBreakProvider, Boolean& isCropped) at DevExpress.Utils.Paint.XPaintMixed.CalcTextSize(Graphics g, String s, Font font, StringFormat strFormat, Int32 maxWidth, Int32 maxHeight, Boolean& isCropped) at DevExpress.Utils.Text.StringPainter.SetupSimpleString(StringInfo info, StringCalculateArgs e) at DevExpress.Utils.Text.StringPainter.Calculate(StringCalculateArgs e) at DevExpress.Utils.Drawing.FooterCellPainter.CalcTextSize(ObjectInfoArgs e) at DevExpress.Utils.Drawing.FooterCellPainter.CalcObjectMinBounds(ObjectInfoArgs e) at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcGroupFooterCellHeight() at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcGroupFooterHeight() at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcRectsConstants() at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcRects(Rectangle bounds, Boolean partital) at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcCore(Graphics g, Rectangle bounds) at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.Calc(Graphics g, Rectangle bounds) at DevExpress.XtraGrid.Views.Base.ColumnView.DoInternalLayout() at DevExpress.XtraGrid.Views.Base.ColumnView.CalculateLayout() at DevExpress.XtraGrid.Views.Grid.GridView.LayoutChanged() at DevExpress.XtraGrid.Views.Base.BaseView.EndUpdateCore(Boolean synchronized) at DevExpress.XtraGrid.Views.Base.ColumnView.OnDataController_DataSourceChanged(Object sender, EventArgs e) at DevExpress.XtraGrid.Views.Grid.GridView.OnDataController_DataSourceChanged(Object sender, EventArgs e) at DevExpress.Data.DataControllerBase.RaiseListSourceChanged() at DevExpress.Data.DataControllerBase.SetListSourceCore(IList value) at DevExpress.Data.CurrencyDataController.OnDataSourceChanged() at DevExpress.Data.CurrencyDataController.SetDataSource(BindingContext context, Object dataSource, String dataMember) at DevExpress.XtraGrid.Views.Base.BaseView.SetDataSource(BindingContext context, Object dataSource, String dataMember) at DevExpress.XtraGrid.Views.Grid.GridView.SetDataSource(BindingContext context, Object dataSource, String dataMember) at DevExpress.XtraGrid.GridControl.ActivateDataSource() at DevExpress.XtraGrid.GridControl.set_DataSource(Object value) at UserControlList.RefreshData()

And I do use Invoke() in that method.

Show previous comments (5)
Nadezhda (DevExpress Support) 8 years ago

    Hello,

    I've created a separate ticket on your behalf (The NullReference exception occurs when the LayoutChanged method is called). It has been placed in our processing queue and will be answered shortly.

    RW RW
    Ruud Wildenberg 7 years ago

      Still no fix?

      DevExpress Support Team 7 years ago

        Hello Ruud,

        I have already replied to you at FontsCache might be sharing GDI resources between different threads. Is it possible to provide us with a sample where the issue occurs so we can investigate it on our side? If so, please share that sample in a separate thread so we can research the cause of the issue.

        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.