I have a panel in a Form that uses Toolbars.I that Panel I draw and "move" objets (be redrawing)
Everything worked fine until I stardet to Use
ThreadPool.QueueUserWorkItem( _ New Threading.WaitCallback(
to make asynchronous call for some time consuming methods. Now, I have the follwing:
------------------------------------------------------An application UnhandledException were thrown.The application will now terminate.'Object reference not set to an instance of an object.'StackTrace: at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolbarToolRow.InternalAddTool(ToolBase tool, Size toolSize, Boolean needsHorizontalSeparator) at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolGroup.CalculateMetrics(Int32 maxWidth) at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolbarMetrics.CalculateFloatingMetricsHelper(ToolGroup[] toolGroups, Int32 maxWidth) at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolbarMetrics.CalculateFloatingMetrics(Size cachedSize, Size delta) at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.GetMetrics(Size cachedSize, Size delta) at Infragistics.Win.UltraWinToolbars.UltraToolbarBase.ToolAreaInformation.FromToolbar(UltraToolbarBase toolbar, Rectangle overallArea) at Infragistics.Win.UltraWinToolbars.ToolbarUIElement.PositionChildElements() 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) 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.UltraWinToolbars.UltraToolbarsDockArea.OnPaint(PaintEventArgs pe) 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)---------------------------OK ---------------------------
Then , the toolboxex became white + redCrossed.
As you can see the exception is not even handled, but intercepted OnUnhandledApplication on the application level...
Are you interacting with the UltraToolbarsManager or any of its sub-objects in the thread pool threads? If so, this is not allowed. Just like other WinForms Controls and Components, you con only access it from the UI thread. There are certain exceptions to this rule, such as when calling Invoke, BeginInvoke, and InvokeRequired. But for just about everything else, you must invoke calls to the UI thread when you want to interact with the UltraToolbarsManager.
I don't interract with them in the newly created thread...
What are you doing in the background thread? Is it anything that could call other methods which might be trying to interact with controls?
In the background thread I Clone my Business Object.... Nothing to do with the UI
Can you please describe what you did to resolve your problem? I am experiencing the same error.
No need anymore, I solved my problem, but just noticed one more Infragistics components problem
Say, Me.TaskContainerMemory.SaveMemento(_TaskContainer.GetMemento()) is my custom time consuming action, then: a) This generates exceptions: System.Threading.ThreadPool.QueueUserWorkItem( _ New Threading.WaitCallback( _ Sub(o) Me.TaskContainerMemory.SaveMemento(_TaskContainer.GetMemento()) End Sub))b) This does not:Dim myFactory = New System.Threading.Tasks.TaskFactorymyFactory.StartNew(Sub() Me.TaskContainerMemory.SaveMemento(_TaskContainer.GetMemento()) End Sub)
We do have customers send applications occasionally so we can debug them but I understand if your company will not allow that. I will have a DS engineer contact you anyway and maybe they will be able to help track down the problem.
"send them the application" are you kidding or just junior stuff member?
What IT company will send any application to any other IT company? I don't say already the requested server and database installation for lauching the application, and other specific requirements for that "heavy" monster...
I can't tell what the problem is from the stack trace. If I put you in contact with a Developer Support engineer, would you be able to send them the application so we can test it here?