PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Crash after upgrading to 2.0
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Crash after upgrading to 2.0
![]() |
Crash after upgrading to 2.0 |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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" |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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" |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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" > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

