Version: NetAdvantage Select 2010 Vol. 3 (WinForms)Component: Infragistics Ultragrid
Operation system with error: Windows XP Pro
---------------------------
A customer of us is experiencing the "red cross" error followed with an error messages that states:
"object is currently in use elsewhere"
System.InvalidOperationException: The object is currently in use elsewhere
by System.Drawing.Graphics.get_Transform();
by Infragistics.Win.Graphics.Transform.TransformRectangle(Graphics ... ).......
..............
This error throws itself when an user is (re)loading (refresh) the grid with data or using the filter fields on the grid when the data has been bound to the grid.
The application don't use multithreading. There are also no special techniques or such used. Just retrieve data from the SQL server (on the server) and databind the datatable to the grid in the client application.
We never had such experience with this component and other customers with the same application never had or having this problem (running other OS). We also can't reproduce this error on our own developer PC's and on our customer demo server.
Can someone help me in finding out why and how it's possible this customer is the only one experiencing this on all of its workstations or where I have to look for the real cause.
Mike,
The issue was with our code only. Sorry for the trouble. As mentioned earlier we are using a CE database and to check whether the database is already connected instead of using the Connection.State property we used the Connect() property which caused the issue.
Appreciate your immediate reply.
Thanks,
Keerti Somasundaram
Hi Keerti,
Are you using the latest service release?
I did a little research and I came across an interesting blog about this error message: "Object is currently in use elsewhere" error. - Peter Ritchie's MVP Blog
As it happens, although we were never able to reproduce the problem as reported here, we did recently fix a similar issue caused by some caching we were doing with the UltraExplorerBar control.There was a problem in the animation code that wasn't cleaning up properly and it could cause this error.
So if you are using the UltraExplorerBar (or even if you are not), my first recommendation is that you get the latest service release for NetAdvantage and see if that corrects the error.
How to get the latest service release - Infragistics Community
We are experiencing the same issue
below is the exception detail :
System.InvalidOperationException: Object is currently in use elsewhere. at System.Drawing.Graphics.GetNearestColor(Color color) at Infragistics.Win.DrawCache.GetNearestColor(Color color) at Infragistics.Win.DrawCache.Infragistics.Win.IDrawCache.GetNearestBackColor(Color color) at Infragistics.Win.DrawUtility.DrawBackColor(Control control, Graphics graphics, AppearanceData& appearanceData, Rectangle rect, Rectangle invalidRect, Boolean enabled, IDrawCache drawCache, AlphaBlendMode alphaBlendMode, Blend blend) at Infragistics.Win.UIElementDrawParams.DrawBackColor(Rectangle rect) at Infragistics.Win.UIElement.DrawBackColor(UIElementDrawParams& drawParams) at Infragistics.Win.UltraWinToolbars.UltraToolbarsDockAreaUIElement.DrawBackColor(UIElementDrawParams& drawParams) at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams) 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.UltraWinToolbars.UltraToolbarsDockArea.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(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)
I know its hard to answer with just the exception detail.But if you could give me suggesstions based out of your experience on how to go about it would be great. Our application is a single threaded app. We were using 7.3 version assemblies and we werent facing any issues. We then migrated our app which is a plug-in to a later version of its parent application which was using v10.3 assemblies , we started facing the issue at this point. Then we migrated our assemblies to use v10.3 to see if its because of the assembly mismatch but then it wasnt because of that either. The Infragistics controls are pulling data from a SQL CE database. This is where the crash happens , i can see the IntializeComponent gets executed fine and after that when datasource is getting set this crash occurs.
Any ideas , suggestions are greatly welcome....:)
Keerti
I have adjusted the application by adding code that Updates the grid at BeforeRowFilterChanged.
The component we used is a custom component that inherits the WinGrid.In the component class I have override the paint method and added the base.OnPaint(evtargs)
The customer has not yet encountered a red cross since this update.We also have added a lot of logging and it all seems to go well.
Problem solved
Hi,
That's interesting and I have never seen that before. But I'm afraid it does not help us determine the cause of the issue.
Are you handling any events in the grid that might be triggering by a filtering operation? There are the obvious events like Before/AfterRowFilterChanged, of course. And some not-so-obvious ones like IniitalizeRow and maybe Before/AfterRowActivated or Before/AfterSelectChange. Perhaps in one of these events you are using a BeginInvoke or a DoEvents statement that is causing things to get out of synch.
These are all just wild guesses, really, but it's the best I can do without being able to duplicate the issue.