ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2015-09-11 10:52:55

toto_fr_2001
Member
Registered: 2015-09-11
Posts: 7

Error : "Object is currently in use elsewhere."

Version 9.0 beta (appeared also in older version)

1. Thanks for your marvelous control.
2. I get, sometime, an exception. Does anyone got the same error?
    The result is the control with no grid and red borders with red diagonals (I do not
    know how to post a screenshot in this forum)   

Thanks, Damien

************** Exception Text **************
System.InvalidOperationException: Object is currently in use elsewhere.
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.FillRectangle(Brush brush, Single x, Single y, Single width, Single height)
   at System.Drawing.Graphics.FillRectangle(Brush brush, RectangleF rect)
   at a2.FillRectangle(IColor color, Rectangle rect)
   at bn.ai(CellDrawingContext A_0)
   at b4.y(CellDrawingContext A_0)
   at b4.ai(CellDrawingContext A_0)
   at co.b7(CellDrawingContext A_0)
   at cs.b7(CellDrawingContext A_0)
   at unvell.ReoGrid.ReoGridControl.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 unvell.ReoGrid.ReoGridControl.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.
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
ExcelDna.Loader
    Assembly Version: 0.32.5236.31782
    Win32 Version: 4.0.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
ExcelDna.Integration
    Assembly Version: 0.32.5236.31783
    Win32 Version: 4.0.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.
    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.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
.....

Offline

#2 2015-09-11 12:02:10

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Error : "Object is currently in use elsewhere."

Hi Damien, thanks for the information, hope this control helps you. I will check for this, and reply again shortly.

Last edited by Jingwood (2015-09-11 12:12:47)

Offline

#3 2015-09-12 17:48:54

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Error : "Object is currently in use elsewhere."

It is hard to make this happen in my environment, may need more time to confirm. Is there any tips for reappear?

Offline

#4 2015-09-15 12:58:05

toto_fr_2001
Member
Registered: 2015-09-11
Posts: 7

Re: Error : "Object is currently in use elsewhere."

I am able to reproduce it:
1. Create a user form with the control
2. Create several instances of the form
3. Move the different windows in front of the others choosing one or another to force redraw.
After a while the grid of one of the windows (not top one, one below) has this red cross.
The grid is still OK in the sense I can access it in debug mode.
It seems that only the refreshing is not working properly

At present moment , I made a right-click to reset the grid (dispose & create new one, not so nice)

I can send the image by email, maybe you know the problem already
Do you have an email where I can send the image?

Last edited by toto_fr_2001 (2015-09-16 08:22:54)

Offline

#5 2015-09-17 10:47:01

toto_fr_2001
Member
Registered: 2015-09-11
Posts: 7

Re: Error : "Object is currently in use elsewhere."

It could be because ReoGrid does not handle well threads:
This is the method to reproduce it.
If you want I can send you the solution.

A. Follow 1 to 4 below to create the solution
B. Run it. Seven Form1 with one grid in each will be created
C. Begin to move the top one on the top of the others (click down, move,
    click up, redo it several times) to force the redraw.
    You will see the deadly red cross in some of the windows below.

This is really problematic.
We do not want the user's bad feeling associated with it.

Thanks a lot, Damien
----------------------------

How to create the solution:

1. Create a new project Windows Form Application
2. Add the reference to Reogrid
3. In the Program.cs, Add a reference to the threading:
using System.Threading;

and replace the class Program:
I need a locker for the threads:

    static class Program
    {
        static volatile object locker = new Object();
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Thread thread1 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));
            Thread thread2 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));
            Thread thread3 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));
            Thread thread4 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));
            Thread thread5 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));
            Thread thread6 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));
            Thread thread7 = new Thread(new ThreadStart(() => { Application.Run(new Form1(locker)); }));

            thread1.Start();
            thread2.Start();
            thread3.Start();
            thread4.Start();
            thread5.Start();
            thread6.Start();
            thread7.Start();
        }
    }


4. Add this code to Form1 to create a grid:

    public partial class Form1 : Form
    {
        unvell.ReoGrid.ReoGridControl grid = null;

        public Form1(object locker)
        {
            InitializeComponent();
            this.Width = 500;
            this.Height = 500;

            lock (locker)
            {
                grid = new unvell.ReoGrid.ReoGridControl();

                this.grid.Name = "grid";

                grid.Top = 0;
                grid.Left = 0;
                grid.Width = this.Width;
                grid.Height = this.Height;

                this.Controls.Add(grid);
            }
        }
    }

Offline

#6 2015-09-18 05:53:48

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Error : "Object is currently in use elsewhere."

Thank you for the detailed information. I am now testing this problem and going to fix it.

Offline

#7 2015-09-18 08:40:31

toto_fr_2001
Member
Registered: 2015-09-11
Posts: 7

Re: Error : "Object is currently in use elsewhere."

Thanks, If I can be of any help let me know it

Offline

#8 2015-09-30 16:29:45

toto_fr_2001
Member
Registered: 2015-09-11
Posts: 7

Re: Error : "Object is currently in use elsewhere."

After using the beta version 9.1.0
I still get the same error

unvell.ReoGrid
    Assembly Version: 0.9.1.0
    Win32 Version: 0.9.1.0
 
any idea?
Thanks, Damien

************** Exception Text **************
System.ArgumentException: Parameter is not valid.
   at System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
   at System.Drawing.Graphics.MeasureString(String text, Font font, Int32 width, StringFormat format)
   at unvell.ReoGrid.Worksheet.a(Graphics A_0, ReoGridCell A_1, DrawMode A_2, Single A_3)
   at unvell.ReoGrid.Worksheet.a(IGraphics A_0, ReoGridCell A_1, DrawMode A_2, Single A_3)
   at unvell.ReoGrid.Worksheet.a(ReoGridCell A_0, DrawMode A_1)
   at cj.a.c(Int32 A_0, Int32 A_1, ReoGridCell A_2)
   at unvell.ReoGrid.Data.JaggedTreeArray`1.a(Int32 A_0, Int32 A_1, Int32 A_2, Int32 A_3, Boolean A_4, Func`4 A_5)
   at cj.i(b5 A_0, b5 A_1)
   at cj.j()
   at cj.b5()
   at unvell.ReoGrid.Worksheet.i()
   at unvell.ReoGrid.ReoGridControl.o(Object A_0, EventArgs A_1)
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at unvell.ReoGrid.ReoGridControl.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.ScrollableControl.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnParentVisibleChanged(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.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.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.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
ExcelDna.Loader
    Assembly Version: 0.32.5236.31782
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34238 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34234 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
ExcelDna.Integration
    Assembly Version: 0.32.5236.31783
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34251 built by: FX452RTMGDR
    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.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
...
----------------------------------------
ExcelDna.DynamicDelegateAssembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
...
----------------------------------------
ExcelDna.Utilities
    Assembly Version: 0.1.1.0
    Win32 Version: 0.1.1
    CodeBase: file:///K:/global/dev/smart_20150930/bin/ExcelDna.Utilities.DLL
----------------------------------------
...
----------------------------------------
unvell.ReoGrid
    Assembly Version: 0.9.1.0
    Win32 Version: 0.9.1.0
    CodeBase: file:///K:/global/dev/smart_20150930/bin/unvell.ReoGrid.DLL
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------

Last edited by toto_fr_2001 (2015-09-30 16:31:13)

Offline

#9 2015-10-01 00:13:34

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Error : "Object is currently in use elsewhere."

There still some points that need to be improvement for multiple thread operations. We will try to fix this.

Offline

#10 2015-10-27 13:50:23

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Error : "Object is currently in use elsewhere."

We've confirmed that problem 'Parameter is not valid.' and now it should be fixed in latest release 0.9.2.0, please download from https://reogrid.net/download.

Thanks for report!

Offline

Board footer

Powered by FluxBB