Hide()/Show() exception : Fixed

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Hide()/Show() exception : Fixed

Post by Dave » Thu Oct 23, 2008 2:44 pm

Hello,

I am having a strange problem with teechart.

I have a chart in a form I am using, when the form is hidden and then shown again an exception is thrown caused by a paint handler in teechart.

Other forms with charts seem to be able to hide and show again easily.

I have included a stack trace. I can't really provide code to reproduce this as it would really need the whole application and some hardware!

Any help would be much appreciated!

Dave


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'NewScanWindow'.
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.ContainerControl.FocusActiveControlInternal()
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.Show()
at LPPS_UI.LPPSUI.newScanCommand() in C:\Documents and Settings\Dev\Desktop\Source Code\LPPS UI\LPPS UI\LPPSUI.cs:line 177
at LPPS_UI.LPPSUI.newToolStripButton_Click(Object sender, EventArgs e) in C:\Documents and Settings\Dev\Desktop\Source Code\LPPS UI\LPPS UI\LPPSUI.cs:line 217
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.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: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
LPPS UI
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/LPPS%20UI.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SplashScreen
Assembly Version: 1.0.3218.24629
Win32 Version: 1.0.3218.24629
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/SplashScreen.DLL
----------------------------------------
Delegates
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/Delegates.DLL
----------------------------------------
DSOCSFactory
Assembly Version: 0.0.0.0
Win32 Version: 0.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/DSOCSFactory.DLL
----------------------------------------
Laser
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/Laser.DLL
----------------------------------------
FTD2XX_NET
Assembly Version: 1.0.2.0
Win32 Version: 1.0.2.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/FTD2XX_NET.DLL
----------------------------------------
Monochromator
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/Monochromator.DLL
----------------------------------------
Experiment
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/Experiment.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
AxInterop.ZOLIXOMNISPECLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/AxInterop.ZOLIXOMNISPECLib.DLL
----------------------------------------
LPPS UI.resources
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/en/LPPS%20UI.resources.DLL
----------------------------------------
Interop.ZOLIXOMNISPECLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/Interop.ZOLIXOMNISPECLib.DLL
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
ToolBox
Assembly Version: 1.0.4.0
Win32 Version: 1.0.4.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/ToolBox.DLL
----------------------------------------
Scan Settings
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/Scan%20Settings.DLL
----------------------------------------
ejhqad_5
Assembly Version: 1.0.3218.24629
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
yuorcp_5
Assembly Version: 1.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
y5tij6kg
Assembly Version: 1.0.4.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
TeeChart
Assembly Version: 3.5.3146.24806
Win32 Version: 3.5.3146.24806
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/TeeChart.DLL
----------------------------------------
UIParamValidators
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Dev/Desktop/Source%20Code/LPPS%20UI/LPPS%20UI/bin/Debug/UIParamValidators.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Last edited by Dave on Fri Oct 24, 2008 11:07 am, edited 1 time in total.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Oct 23, 2008 3:07 pm

Hi Dave,

It's very difficult for us finding which the problem is and fixing it without being able to reproduce it. So it would be very helpful if you could isolate the problem and arrange a simple example project we can run "as-is" to reproduce the issue here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Thu Oct 23, 2008 3:26 pm

Okay, i think this should replicate the problem, also doing it seems to have helped me track it down!

Ive uploaded a file to demonstrate.

Sorry the examples a bit hacked together!

In the example a form2 is created as an mdichild of a form1.

When you click the button on form 2 (the one with the tchart) it hides it, then when you click on the button on form 1 (the mdi parent) it tries to Show() form2 again at which point you get an unhandled exception.

It seems to be the MDI parent/child part which is causing the problem as it does not seem to occur if form1 just contains form2 as an ordinary variable.

Hope this helps and that you can help me! :D

Thanks in advance,
Dave

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Oct 24, 2008 10:41 am

Hi Dave,

Thanks for the example project. We could solve the issue here initializing Form2 like this:

Code: Select all

        public Form2() {
            InitializeComponent();
						this.tChart1.Graphics3D.UseBuffer = false;
        }
Can you please check if this works fine at your end?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Post by Dave » Fri Oct 24, 2008 11:06 am

That works great thanks!

What is it about the buffering that actually causes the problem?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Oct 24, 2008 3:18 pm

Hi Dave,

You're welcome.

This because there seem to be a number of problems using the BufferedGraphics and BufferedGraphicsContext classes with MDI applications.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply