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
185
UltraComboEditor crashing in SetFont with NullReferenceException
posted

Guys,

We have a .Net 2 Windows forms app using Infragistics 2008 v2 controls extensively, including the MDI tab manager and combo controls.
We are seeing occasionally crashing in the UltraComboEditor as below.  We can't reproduce it easily currently, but it seems to happen on slow
machines which are either very busy or have a poor wireless connectivity.  It looks like some sort of timing problem. 
This problem is causing disquiet amongst our users so we need to find a solution or workaround.

It looks identical to a problem someone reported in 2005 at
http://news.archive.infragistics.com/readmessage?id=%3C43983 1d4$1@mailgw.shersoft.com%3E&group=infragistics.products.netadvantage.windowsforms.wineditors
but this was obviously a much older version of of the control library
 
Any help appreciated.

Mark
-----------------------------------


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Infragistics.Win.EmbeddableTextBox.SetFont(AppearanceData& appData, Control owningControl)
   at Infragistics.Win.EmbeddableTextBox.ApplyAppearance(AppearanceData appData)
   at Infragistics.Win.EmbeddableTextBox.Initialize(EmbeddableUIElementBase owningElement)
   at Infragistics.Win.EditorWithText.DisplayTextBox()
   at Infragistics.Win.EditorWithCombo.DisplayTextBox()
   at Infragistics.Win.EditorWithText.OnBeforeEnterEditMode(Boolean& cancel)
   at Infragistics.Win.EmbeddableEditorBase.EnterEditMode(EmbeddableUIElementBase embeddableElement)
   at Infragistics.Win.UltraWinEditors.TextEditorControlBase.OnEnter(EventArgs e)
   at Infragistics.Win.UltraWinEditors.UltraComboEditor.OnEnter(EventArgs e)
   at System.Windows.Forms.Control.NotifyEnter()
   at System.Windows.Forms.ContainerControl.UpdateFocusedControl()


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Issue891
    Assembly Version: 5.0.0.893
    Win32 Version: 5.0.0.893
    CodeBase: file://moderngovsvr/mgClient/Issue891.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
Microsoft.VisualBasic.Compatibility
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.1433
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic.Compatibility/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.Compatibility.dll
----------------------------------------
Infragistics2.Win.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Win.v8.1.DLL
----------------------------------------
Infragistics2.Win.UltraWinToolbars.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Win.UltraWinToolbars.v8.1.DLL
----------------------------------------
Infragistics2.Shared.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Shared.v8.1.DLL
----------------------------------------
Infragistics2.Win.UltraWinTabbedMdi.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Win.UltraWinTabbedMdi.v8.1.DLL
----------------------------------------
System.Design
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Design/2.0.0.0__b03f5f7f11d50a3a/System.Design.dll
----------------------------------------
Scripting
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file://moderngovsvr/mgClient/Scripting.DLL
----------------------------------------
Infragistics2.Win.Misc.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Win.Misc.v8.1.DLL
----------------------------------------
Infragistics2.Win.UltraWinEditors.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Win.UltraWinEditors.v8.1.DLL
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Word
    Assembly Version: 8.1.0.0
    Win32 Version: 8.1.0.0
    CodeBase: file://moderngovsvr/mgClient/Word.DLL
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Infragistics2.Win.UltraWinStatusBar.v8.1
    Assembly Version: 8.1.20081.1000
    Win32 Version: 8.1.20081.1000
    CodeBase: file://moderngovsvr/mgClient/Infragistics2.Win.UltraWinStatusBar.v8.1.DLL
----------------------------------------
Keyoti.RapidSpell.NET2
    Assembly Version: 3.7.0.3110
    Win32 Version: 3.7.0.3110
    CodeBase: file://moderngovsvr/mgClient/Keyoti.RapidSpell.NET2.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

 

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Mark,

    I'm afraid I don't have any great magic fix for you here. But I do have a suggestion that might help. 

    From the call stack here, it appears that the crash is occurring when the  UltraTextEditor is entered.What happens is that when the UltraTextEditor gets focus, it creates a derived Microsoft TextBox control and positions it over itself to allow the user to edit. This gives the user all the built-in functionality of the Windows TextBox without us here at Infragistics having to re-invent the wheel so to speak. 

    Before the TextBox gets displayed, the UtraTextEditor sets it up to look the same (or as close as possible) to the UltraTextEditor. So it looks like it's failing when it tries to apply the font to it. I don't know why that would happen. It seems like setting the Font on a TextBox would be a no-brainer operation. I know that there are some strange issues with TextBoxes that sometime setting certain properties on them causes them to get re-created, so we sometimes have to be careful about the order in which certain properties are set. But in this case, there's not much to go on in terms of figuring out what the problem is. 

    Anyway, since the problem is occuring on the showing of the TextBox, you can cut down significantly on the number of times this process occurs by setting the AlwaysInEditMode property to true. With this property set, you will lose a little bit of functionality on the control. It won't draw text using GDI+ (it will use GDI instead) and it won't be able to display gradients or hash brushes (but you probably aren't using those on a TextBox, anyway). The up side is that the control will enter edit mode the first time it paints and stay that way forever, so it will not continuously be showing and hiding the TextBox every time it gains and loses focus.

    Hopefully, that will avoid, or at least significantly reduce, the occurrance of whatever error is happening here. 

Reply Children