Here is the relevant code I am running on a separate thread which has thrown an Unhandled Exception. The text of the Unhandled Exception is below the code.
txtProcess is an Infragistics text editor set at multi-line with scrollbars.
public delegate void UpdateTextCallBack(string msg);
private void UpdateRunStatus(string msg) { try { txtProcess.Text += HelperFunctions.NewLine() + msg; txtProcess.SelectionStart = txtProcess.Text.Length; txtProcess.ScrollToCaret(); } catch (Exception) { throw; } }
in my method running on a different thread, I call at various times (where msg is a string variable):
txtProcess.Invoke(new UpdateTextCallBack(this.UpdateRunStatus),msg);
There could be many messages sent to the text box and the error does not happen every run, and if the text box has the focus(), it has not occurred yet. The text box is read only, but the user can change the focus to other controls while the thread is running.
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 System.ComponentModel.PropertyDescriptorCollection.Find(String name, Boolean ignoreCase) at Infragistics.Win.BindableValueList.GetBoundValueHelper(ValueListItem item, String propertyName) at Infragistics.Win.BindableValueList.GetBoundDisplayText(ValueListItem item) at Infragistics.Win.ValueListItem.get_DisplayText() at Infragistics.Win.ValueList.DoesTextMatch(String text, String format, IFormatProvider formatProvider, ValueListItem item, ValueListItemMatchingMode itemMatchingMode) at Infragistics.Win.ValueListItemsCollection.GetItemFromDisplayTextOnly(Int32& lastValueListIndex, String displayText) at Infragistics.Win.ValueList.FindByDisplayText(Int32& lastValueListIndex, String displayText) at Infragistics.Win.ValueList.Infragistics.Win.IValueList.GetValue(String text, Int32& index) at Infragistics.Win.EditorWithTextUIElement.GetImage(String text, AppearanceData& appData) at Infragistics.Win.EditorWithTextUIElement.PositionChildElements() at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive) at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics) at Infragistics.Win.UIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize) at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode) at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe) at Infragistics.Win.UltraWinEditors.TextEditorControlBase.OnPaint(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)************** Loaded Assemblies **************mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.269 (RTMGDR.030319-2600) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll----------------------------------------Microsoft.VisualStudio.HostingProcess.Utilities Assembly Version: 10.0.0.0 Win32 Version: 10.0.30319.1 CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.HostingProcess.Utilities/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.HostingProcess.Utilities.dll----------------------------------------System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.278 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll----------------------------------------System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.282 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll----------------------------------------System Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.269 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll----------------------------------------Microsoft.VisualStudio.HostingProcess.Utilities.Sync Assembly Version: 10.0.0.0 Win32 Version: 10.0.30319.1 CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.HostingProcess.Utilities.Sync/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll----------------------------------------Microsoft.VisualStudio.Debugger.Runtime Assembly Version: 10.0.0.0 Win32 Version: 10.0.30319.1 CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Debugger.Runtime/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Debugger.Runtime.dll----------------------------------------vshost32 Assembly Version: 10.0.0.0 Win32 Version: 10.0.30319.1 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/OTB.vshost.exe----------------------------------------Microsoft.VisualBasic Assembly Version: 10.0.0.0 Win32 Version: 10.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll----------------------------------------System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.233 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll----------------------------------------System.DirectoryServices.AccountManagement Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.DirectoryServices.AccountManagement/v4.0_4.0.0.0__b77a5c561934e089/System.DirectoryServices.AccountManagement.dll----------------------------------------System.Runtime.Serialization.Formatters.Soap Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization.Formatters.Soap/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.Serialization.Formatters.Soap.dll----------------------------------------System.Xml.Linq Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll----------------------------------------System.Data.DataSetExtensions Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Data.DataSetExtensions/v4.0_4.0.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll----------------------------------------Microsoft.CSharp Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll----------------------------------------System.Data Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll----------------------------------------System.Deployment Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Deployment/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll----------------------------------------System.Xml Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.233 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll----------------------------------------OTB Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/OTB.EXE----------------------------------------OTB_BAL Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/OTB_BAL.DLL----------------------------------------Infragistics4.Win.UltraWinExplorerBar.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinExplorerBar.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinExplorerBar.v12.1.dll----------------------------------------Infragistics4.Win.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.v12.1.dll----------------------------------------Infragistics4.Win.UltraWinDock.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinDock.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinDock.v12.1.dll----------------------------------------Infragistics4.Win.UltraWinStatusBar.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinStatusBar.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinStatusBar.v12.1.dll----------------------------------------Infragistics4.Win.UltraWinToolbars.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinToolbars.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinToolbars.v12.1.dll----------------------------------------Infragistics4.Shared.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Shared.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Shared.v12.1.dll----------------------------------------Infragistics4.Win.UltraWinTabbedMdi.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinTabbedMdi.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinTabbedMdi.v12.1.dll----------------------------------------PromoDAL Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/PromoDAL.DLL----------------------------------------CCommon Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/CCommon.DLL----------------------------------------Microsoft.Practices.EnterpriseLibrary.Data Assembly Version: 5.0.414.0 Win32 Version: 5.0.414.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Data.DLL----------------------------------------Microsoft.Practices.EnterpriseLibrary.Common Assembly Version: 5.0.414.0 Win32 Version: 5.0.414.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.DLL----------------------------------------System.Transactions Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll----------------------------------------System.Configuration Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll----------------------------------------System.EnterpriseServices Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 (RTMRel.030319-0100) CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll----------------------------------------Infragistics4.Win.Misc.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.Misc.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.Misc.v12.1.dll----------------------------------------Infragistics4.Win.UltraWinEditors.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinEditors.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinEditors.v12.1.dll----------------------------------------Accessibility Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll----------------------------------------C1.C1Report.4 Assembly Version: 4.6.20122.54512 Win32 Version: 4.6.20122.54512 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/C1.C1Report.4.DLL----------------------------------------System.Numerics Assembly Version: 4.0.0.0 Win32 Version: 4.0.30319.1 built by: RTMRel CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll----------------------------------------Microsoft.Practices.Unity Assembly Version: 2.0.414.0 Win32 Version: 2.0.414.0 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/Microsoft.Practices.Unity.DLL----------------------------------------C1.Win.C1FlexGrid.4 Assembly Version: 4.6.20122.698 Win32 Version: 4.6.20122.698 CodeBase: file:///C:/Users/glenn/Documents/Visual%20Studio%202010/Projects/OTB/OTB/bin/Debug/C1.Win.C1FlexGrid.4.DLL----------------------------------------Infragistics4.Win.UltraWinTabControl.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinTabControl.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinTabControl.v12.1.dll----------------------------------------Infragistics4.Win.UltraWinGrid.v12.1 Assembly Version: 12.1.20121.1001 Win32 Version: 12.1.20121.1001 CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Infragistics4.Win.UltraWinGrid.v12.1/v4.0_12.1.20121.1001__7dd5c3163f2cd0cb/Infragistics4.Win.UltraWinGrid.v12.1.dll----------------------------------------sjxsjyle Assembly Version: 4.6.20122.54512 Win32 Version: 4.0.30319.269 built by: RTMGDR CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll----------------------------------------************** JIT Debugging **************To enable just-in-time (JIT) debugging, the .config file for thisapplication or computer (machine.config) must have thejitDebugging value set in the system.windows.forms section.The application must also be compiled with debuggingenabled.For example:<configuration> <system.windows.forms jitDebugging="true" /></configuration>When JIT debugging is enabled, any unhandled exceptionwill be sent to the JIT debugger registered on the computerrather than be handled by this dialog box.
Hi,
From the call stack here, it looks like you must be using UltraComboEditor, not UltraTextEditor. Is that right? It probably doesn't make any difference, I just want to make sure we're on the same page and that you are looking at the right control. Since the call stack is trying to look at the ValueList and UltraTextEditor doesn't have one, it seems like this has to be an UltraComboEditor.
Anyway, the control appears to be blowing up while painting. This is what often happens when there is a threading issue. And the fact you mentioned you are using multiple threads seems to bear that out. You seem to be doing things correct, calling Invoke on the control. I don't see anything wrong there.
I think what I would do is put a check into your UpdateRunStatus method and check:
txtStatus.InvokeRequired. If that ever returns true, you've got a problem. It probably means that you are calling that method without invoking.
If that does not help, then I'm not sure what else could be going on. The code you have posted here looks okay to me, so my best guess would be that the exception is related to some other code in your application that is not invoking properly and maybe you are looking at the wrong control.
Yes, I noticed reference to value list and wondered why or if TextEditor had one behind scenes somewhere. While there are a couple of combos on the form, the are not referenced at all in any of the code running on other thread; Still trying to figure out what is happening.
Thanks.
If you can get this error to occur, you could look at the call stack and determine which control is blowing up. At least, I think you might be able to do this - unless it's somehow optimized away. Try going back to:
at Infragistics.Win.UltraWinEditors.TextEditorControlBase.OnPaint(PaintEventArgs e)
And look at 'this.Name'.