Crash after upgrading to 2.0


G

Guest

I develop a .NET application in Visual Studio .NET 2003, and I use the 1.1
Framework. If I install my application on a computer with 2.0 (and without
1.1), I get a crash deep inside ButtonBase.OnPaint. If I choose to continue
after the crash, my application shows up, but my custom Buttons are not
painted, so it seems to be happening in there. This does not happen at all
in 1.1. Has the behaviour of the Button class changed in 2.0?
The full stack trace is below:

"System.NullReferenceException: Object reference not set to an instance of
an object.
at System.Windows.Forms.ButtonBase.OnPaint(PaintEventArgs pevent)
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.ButtonBase.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.DebuggableCallback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at AiraExplorer.MainApp.RunApplication() in c:\\(path to file):line 171"
 
Ad

Advertisements

J

Jim Wooley

I just completed a Winform 1.1-2.0 migration and found a number of breaking
changes (some are not caught by the compiler). It took a month to complete
and I was surprised at the number of changes I needed to make. Part of the
delay was self-inflicted as I decided to move up to object binding rather
than some handrolled binding.

I'm not sure what your specific issue is with the button paint, but have
found that you can't expect to just recompile an existing 1.1 app under 2.0
and not experience any challenges.

Jim
 
Ad

Advertisements

G

Guest

The crash was caused by inheritance from ButtonBase. This appears to work in
1.1,
but not 2.0. Modifying the class to inherit from Button solved the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top