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
40
NullReferenceException occurring in DrawUtility.MeasureStringHelper
posted

Hello,

Recently we started seeing a bug appear that was occurring in the DrawUtility.MeasureStringHelper. We have not yet been able to replicate the error, but below is a part of one of the stack traces that we received.

System.NullReferenceException: Object reference not set to an instance of an object.
at Infragistics.Win.DrawUtility.MeasureStringHelper(Graphics gr, String text, Font font, Size layoutArea, StringFormat stringFormat, Int32& charactersFitted, Int32& linesFilled, Boolean returnElementsFitted, GdiDrawStringFlags drawStringFlags)
at Infragistics.Win.DrawUtility.MeasureString(Graphics gr, String text, Font font, GdiDrawStringFlags drawStringFlags)
at Infragistics.Win.Utilities.CreateLargestFont(AppearanceData[] appearances, Font baseFont, GdiDrawStringFlags gdiDrawStringFlags)
at Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.CreateTabMetricsFont(MdiTabGroup tabGroup)
at Infragistics.Win.UltraWinTabbedMdi.MdiTabGroup.Infragistics.Win.UltraWinTabs.ITabProvider.CreateMetricsFont()
at Infragistics.Win.UltraWinTabs.TabManager.CalculateAllMetrics()
at Infragistics.Win.UltraWinTabs.TabManager.VerifyMetrics()
at Infragistics.Win.UltraWinTabs.TabManager.get_TabAreaSize()
at Infragistics.Win.UltraWinTabbedMdi.TabGroupInfoManager.RecalculateTabGroupInfo(MdiTabGroup tabGroup)
at Infragistics.Win.UltraWinTabbedMdi.TabGroupInfoManager.VerifyTabGroupMetrics(MdiTabGroup tabGroup)
at Infragistics.Win.UltraWinTabbedMdi.TabGroupInfoManager.GetTabGroupControlRectangle(MdiTabGroup tabGroup)
at Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.PositionAndSizeTabGroups()
at Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.DirtyGroupPosition(MdiTabGroup tabGroup)
at Infragistics.Win.UltraWinTabbedMdi.MdiTabGroup.DirtyTabManager(TabManagerChangeType changeType)
at Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager.MdiChildVisibilityChanged(MdiTab tab)
at Infragistics.Win.UltraWinTabbedMdi.MdiTab.OnMdiChildVisibleChanged(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()

The version of Net Advantage we are using is 2009.2. Im sorry I could not offer really any information outside of the stack trace. I believe we probably have something set wrong that only appears under certain conditions. If someone could point me in the right direction to start looking that would be much appreciated. 

  • 12480
    Offline posted

    Hi Josh,

    Unfortunately, we don't have enough information to tell precisely what could be causing this error. However, we talked about this as a team and we have a few starting points for you.

    First, are you able to update to 15.1? It's possible that whatever is causing this issue has been resolved since 9.2, so it's definitely worth a try to upgrade and see if the issue occurs in the latest version.

    Next, we think the most likely cause for a NullReference exception in MeasureStringHelper is that the Font is disposed. Look for references to Font objects in the application code, specifically any cases where resources might be cleaned up.

    Finally, it's possible that this is a threading issue. Are you using any type of threading in the application?

    Please let us know if you determine a way to reproduce this reliably or if any more information comes up.