PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Crash after upgrading to 2.0

Reply

Crash after upgrading to 2.0

 
Thread Tools Rate Thread
Old 13-12-2005, 09:41 PM   #1
=?Utf-8?B?UiBQZW5uZXI=?=
Guest
 
Posts: n/a
Default Crash after upgrading to 2.0


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"
  Reply With Quote
Old 14-12-2005, 06:20 PM   #2
Jim Wooley
Guest
 
Posts: n/a
Default Re: Crash after upgrading to 2.0

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

"R Penner" <R Penner@discussions.microsoft.com> wrote in message
news:5D92E67B-0790-435C-9316-D6D27474C517@microsoft.com...
>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"



  Reply With Quote
Old 15-12-2005, 06:04 AM   #3
=?Utf-8?B?UiBQZW5uZXI=?=
Guest
 
Posts: n/a
Default Re: Crash after upgrading to 2.0

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.

"Jim Wooley" wrote:

> 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
>
> "R Penner" <R Penner@discussions.microsoft.com> wrote in message
> news:5D92E67B-0790-435C-9316-D6D27474C517@microsoft.com...
> >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"

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off