Connecting Tech Pros Worldwide Help | Site Map

Exception from opening and closing a form several hundred times

Eric Cadwell
Guest
 
Posts: n/a
#1: Jul 21 '05
We're running Load Runner to test a large 1.0 based WinForms application.
I'm getting the following exception when opening and closing a form 400 -
450 times. The form contains several controls and custom UserControls. All
the code is native C#.

I'm not making an explicit call to ToBitmap or DrawIcon in my code. Can
anyone help?


Exception Caught in Main(): at System.Drawing.Graphics.GetHdc()
at System.Drawing.Icon.Draw(Graphics graphics, Rectangle targetRect)
at System.Drawing.Graphics.DrawIcon(Icon icon, Rectangle targetRect)
at System.Drawing.Icon.ToBitmap()
at System.Windows.Forms.ThreadExceptionDialog..ctor(E xception t)
at System.Windows.Forms.ThreadExceptionDialog..ctor(E xception t)
at System.Windows.Forms.ThreadContext.OnThreadExcepti on(Exception t)
at System.Windows.Forms.Control.WndProcException(Exce ption e)
at System.Windows.Forms.ControlNativeWindow.OnThreadE xception(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeMetho
ds+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason,
Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoop( Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Insight.RepUI.Core.Launcher.Main()


TIA,
Eric Cadwell


AlexB
Guest
 
Posts: n/a
#2: Jul 21 '05

re: Exception from opening and closing a form several hundred times


It sounds like the form is not being disposed or disposed
in a timely enough manner. You may want to try
calling .Dispose on form_unload().

Just a thought.
[color=blue]
>-----Original Message-----
>We're running Load Runner to test a large 1.0 based[/color]
WinForms application.[color=blue]
>I'm getting the following exception when opening and[/color]
closing a form 400 -[color=blue]
>450 times. The form contains several controls and custom[/color]
UserControls. All[color=blue]
>the code is native C#.
>
>I'm not making an explicit call to ToBitmap or DrawIcon[/color]
in my code. Can[color=blue]
>anyone help?
>
>
>Exception Caught in Main(): at[/color]
System.Drawing.Graphics.GetHdc()[color=blue]
>at System.Drawing.Icon.Draw(Graphics graphics, Rectangle[/color]
targetRect)[color=blue]
>at System.Drawing.Graphics.DrawIcon(Icon icon, Rectangle[/color]
targetRect)[color=blue]
>at System.Drawing.Icon.ToBitmap()
>at System.Windows.Forms.ThreadExceptionDialog..ctor[/color]
(Exception t)[color=blue]
>at System.Windows.Forms.ThreadExceptionDialog..ctor[/color]
(Exception t)[color=blue]
>at System.Windows.Forms.ThreadContext.OnThreadExcepti on[/color]
(Exception t)[color=blue]
>at System.Windows.Forms.Control.WndProcException[/color]
(Exception e)[color=blue]
>at[/color]
System.Windows.Forms.ControlNativeWindow.OnThreadE xception
(Exception e)[color=blue]
>at System.Windows.Forms.NativeWindow.Callback(IntPtr[/color]
hWnd, Int32 msg, IntPtr[color=blue]
>wparam, IntPtr lparam)
>at[/color]
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW
(MSG& msg)[color=blue]
>at
>System.Windows.Forms.ComponentManager.System.Wind ows.Forms[/color]
..UnsafeNativeMetho[color=blue]
>ds+IMsoComponentManager.FPushMessageLoop(Int32[/color]
dwComponentID, Int32 reason,[color=blue]
>Int32 pvLoopData)
>at System.Windows.Forms.ThreadContext.RunMessageLoop[/color]
(Int32 reason,[color=blue]
>ApplicationContext context)
>at System.Windows.Forms.Application.Run(Form mainForm)
>at Insight.RepUI.Core.Launcher.Main()
>
>
>TIA,
>Eric Cadwell
>
>
>.
>[/color]
Closed Thread