[Mono-bugs] [Bug 402446] New: Winforms.Control.Show() raising error... "System. ObjectDisposedException: The object was used after being disposed."

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Jun 20 23:20:56 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=402446


           Summary: Winforms.Control.Show() raising error...
                    "System.ObjectDisposedException: The object was used
                    after being disposed."
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: x86
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jnallen at oakland.edu
         QAContact: mono-bugs at lists.ximian.com
          Found By: Other


Description of Problem: 

I get an error in Mono that I do not get on Microsoft.  The error occurs in
System.Windows.Forms.Control.CreateControl().  The error is
"System.ObjectDisposedException: The object was used after being disposed."

Detailed Description of Problem:

I am porting my VS2005 projects to mono.  I recently "ported" the docking
windows library that use.  I use the free Magic Docking Cronwood Library
available at: http://www.codeproject.com/KB/miscctrl/magicdocking.aspx for most
of my projects.  

I modified the code to pass MoMA by replacing pinvoke calls with managed code. 
The modified code works well using Visual Studio 2005 on windows.

Unhandled Exception: System.ObjectDisposedException: The object was used after
being disposed.
  at System.Windows.Forms.Control.CreateControl () [0x000a4] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3733 
  at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x0003e] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4923 
  at System.Windows.Forms.Control.set_Visible (Boolean value) [0x0000c] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3372 
  at System.Windows.Forms.Control.Show () [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4308 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:Show ()
  at Crownwood.Magic.Docking.ZoneSequence.RepositionZoneBar
(System.Drawing.Rectangle& clientRect) [0x001cb] in
/home/calibre/TestCase/MagicLibrary/Docking/ZoneSequence.cs:1407 



Steps to reproduce the problem:
1. 

A shortened version of the sourccode is contained in the attached tarball. 
Expand the tarball.

2.  In the /testcase/InventionWhiteboard2004 folder, open the *mono* solution.  

3.  The mono solution will contain 2 projects... InventionWhiteboard2004 and
MagicLibrary.  Build both projects.  Run InventionWhiteboard (which references
MagicLibrary).  

4.  An application with 4 docking windows should show.  Drag and drop a window.
 The runtime error occurs when a window is dropped.

5.  You can run the same projects in Microsoft Visual studio and they will work
fine.

Actual Results:

Unhandled Exception: System.ObjectDisposedException: The object was used after
being disposed.
  at System.Windows.Forms.Control.CreateControl () [0x000a4] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3733 
  at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x0003e] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4923 
  at System.Windows.Forms.Control.set_Visible (Boolean value) [0x0000c] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3372 
  at System.Windows.Forms.Control.Show () [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4308 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:Show ()
  at Crownwood.Magic.Docking.ZoneSequence.RepositionZoneBar
(System.Drawing.Rectangle& clientRect) [0x001cb] in
/home/calibre/TestCase/MagicLibrary/Docking/ZoneSequence.cs:1407 
  at Crownwood.Magic.Docking.ZoneSequence.RepositionControls () [0x0001a] in
/home/calibre/TestCase/MagicLibrary/Docking/ZoneSequence.cs:1151 
  at Crownwood.Magic.Docking.ZoneSequence.OnWindowRemoved (Int32 index,
System.Object value) [0x00008] in
/home/calibre/TestCase/MagicLibrary/Docking/ZoneSequence.cs:893 
  at Crownwood.Magic.Collections.CollectionWithEvents.OnRemoveComplete (Int32
index, System.Object value) [0x0000b] in
/home/calibre/TestCase/MagicLibrary/Collections/CollectionWithEvents.cs:71 
  at System.Collections.CollectionBase.System.Collections.IList.Remove
(System.Object value) [0x0003f] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/corlib/System.Collections/CollectionBase.cs:182 
  at Crownwood.Magic.Collections.WindowCollection.Remove
(Crownwood.Magic.Docking.Window value) [0x00000] in
/home/calibre/TestCase/MagicLibrary/Collections/WindowCollection.cs:38 
  at Crownwood.Magic.Docking.HotZoneFloating.ApplyChange (Point screenPos,
Crownwood.Magic.Docking.Redocker parent) [0x000cf] in
/home/calibre/TestCase/MagicLibrary/Docking/HotZoneFloating.cs:88 
  at Crownwood.Magic.Docking.RedockerContent.ExitTrackingMode
(System.Windows.Forms.MouseEventArgs e) [0x0003e] in
/home/calibre/TestCase/MagicLibrary/Docking/RedockerContent.cs:125 
  at Crownwood.Magic.Docking.Redocker.OnMouseUp
(System.Windows.Forms.MouseEventArgs e) [0x0001b] in
/home/calibre/TestCase/MagicLibrary/Docking/Redocker.cs:61 
  at Crownwood.Magic.Docking.RedockerContent.OnMouseUp
(System.Windows.Forms.MouseEventArgs e) [0x0004a] in
/home/calibre/TestCase/MagicLibrary/Docking/RedockerContent.cs:186 
  at Crownwood.Magic.Docking.WindowDetailCaption.OnMouseUp
(System.Windows.Forms.MouseEventArgs e) [0x00016] in
/home/calibre/TestCase/MagicLibrary/Docking/WindowDetailCaption.cs:378 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m)
[0x0007f] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5412 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x0017c] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5159 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:225 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:206 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x0006a] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:188 
  at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG&
msg) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:3266 
  at System.Windows.Forms.XplatUIX11.WaitForHwndMessage
(System.Windows.Forms.Hwnd hwnd, Msg message) [0x0008b] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:1421 
  at System.Windows.Forms.XplatUIX11.MapWindow (System.Windows.Forms.Hwnd hwnd,
WindowType windows) [0x000ba] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:1458 
  at System.Windows.Forms.XplatUIX11.CreateWindow
(System.Windows.Forms.CreateParams cp) [0x00569] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:2723 
  at System.Windows.Forms.XplatUI.CreateWindow
(System.Windows.Forms.CreateParams cp) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:475 
  at System.Windows.Forms.NativeWindow.CreateHandle
(System.Windows.Forms.CreateParams create_params) [0x0000c] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:112 
  at System.Windows.Forms.Control.CreateHandle () [0x0003f] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4375 
  at System.Windows.Forms.Form.CreateHandle () [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1930 
  at System.Windows.Forms.Control.CreateControl () [0x00044] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3711 
  at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x0003e] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4923 
  at System.Windows.Forms.Form.SetVisibleCore (Boolean value) [0x00071] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:2404 
  at System.Windows.Forms.Control.set_Visible (Boolean value) [0x0000c] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3372 
  at System.Windows.Forms.Control.Show () [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:4308 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:Show ()
  at Crownwood.Magic.Common.DrawHelper.DrawDragRectangles
(System.Drawing.Rectangle[] newRects, Int32 indent) [0x000ad] in
/home/calibre/TestCase/MagicLibrary/Common/DrawHelper.cs:369 
  at Crownwood.Magic.Common.DrawHelper.DrawDragRectangle (Rectangle newRect,
Int32 indent) [0x00000] in
/home/calibre/TestCase/MagicLibrary/Common/DrawHelper.cs:341 
  at Crownwood.Magic.Docking.HotZone.DrawReversible (Rectangle rect) [0x00000]
in /home/calibre/TestCase/MagicLibrary/Docking/HotZone.cs:60 
  at Crownwood.Magic.Docking.HotZoneFloating.DrawIndicator (Point mousePos)
[0x00078] in /home/calibre/TestCase/MagicLibrary/Docking/HotZoneFloating.cs:178 
  at Crownwood.Magic.Docking.RedockerContent.OnMouseMove
(System.Windows.Forms.MouseEventArgs e) [0x00077] in
/home/calibre/TestCase/MagicLibrary/Docking/RedockerContent.cs:166 
  at Crownwood.Magic.Docking.WindowDetailCaption.OnMouseMove
(System.Windows.Forms.MouseEventArgs e) [0x00016] in
/home/calibre/TestCase/MagicLibrary/Docking/WindowDetailCaption.cs:361 
  at System.Windows.Forms.Control.WmMouseMove (System.Windows.Forms.Message& m)
[0x00063] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5598 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m)
[0x001d4] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5214 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage
(System.Windows.Forms.Message& m) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:225 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
(System.Windows.Forms.Message& m) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:206 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr
wParam, IntPtr lParam) [0x0006a] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:188 
  at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG&
msg) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:3266 
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG&
msg) [0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:576 
  at System.Windows.Forms.Application.RunLoop (Boolean Modal,
System.Windows.Forms.ApplicationContext context) [0x00359] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:849 
  at System.Windows.Forms.Application.Run
(System.Windows.Forms.ApplicationContext context) [0x00014] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:635 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm)
[0x00000] in
/home/mirco.bauer/projects/backports/mono/mono-1.9.1+dfsg/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:623 
  at InventionWhiteBoard2004.FMain.Main () [0x00000] in
/home/calibre/TestCase/InventionWhiteBoard2004/FMain.cs:142 



Expected Results:

The windows should drag and drop like they do when I run the program on
Microsoft Windows.  The program is 100% managed code and it passes the MoMA.


How often does this happen? 

Everytime I run the program and drag and drap a docking window.


Additional Information:

I am using Hardy Heron.  I installed the latest version of Mono (1.9.1) by
following the instructions here:

http://www.mono-project.com/Other_Downloads

I think I can work around this bug, but I think it should be reported.  The
docking windows code is a good test case for flexing Mono's compatibility with
Windows.Forms.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list