dotnet windows forms:
I recently experienced an exception similar to this and determined that we made calls to EnableVisualStyles in more than on place. When we removed the duplicate calls, the exception went away. This might be your problem, but it is worth a shot. Chris
We are receiving error reports with NullReferenceExceptions from our users with stacks like the following: at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.DefWndProc(Message& m) at System.Windows.Forms.Control.WmUpdateUIState(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.ParkingWindow.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) --------- Our error reporter also takes a stacktrace at the time the exception was handled, and the common element in all of them is Control.CreateHandle() and the dreaded ParkingWindow. I don't believe this is a threading issue, our app is mostly single-threaded. The OnThreadException method is manually called in code by the NativeWindow.Callback method. An example of the callstack to the handler: at System.Windows.Forms.ThreadContext.OnThreadException(Exception t) at System.Windows.Forms.Control.WndProcException(Exception e) at System.Windows.Forms.ControlNativeWindow.OnThreadException(Exception e) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.DefWndProc(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.ParkingWindow.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.DefWndProc(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.DefWndProc(Message& m) at System.Windows.Forms.Control.WmCreate(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam) at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam) at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.Control.get_Handle() at System.Windows.Forms.Control.AccessibilityNotifyClients(AccessibleEvents accEvent, Int32 childID) at System.Windows.Forms.RadioButton.OnCheckedChanged(EventArgs e) at Application.Namespace.Control.InitializeComponent() ... which is from InitializeComponent() in one of our usercontrols for example. I have seen several posts in this newsgroup describing similar problems, has anyone had any resolution on them? Regards, Matt
Hi Chris, Thanks for the suggestion, however we don't use Application.EnableVisualStyles at all. Regards, Matt [quoted text, click to view] "Chris" <dunawayc@gmail.com> wrote in message news:1105125407.386508.56920@f14g2000cwb.googlegroups.com... > I recently experienced an exception similar to this and determined that > we made calls to EnableVisualStyles in more than on place. When we > removed the duplicate calls, the exception went away. > This might be your problem, but it is worth a shot. > > Chris >
Before Microsoft will respond, you must register on their site with your e-mail address.
This is still an ongoing issue for us. We are told by Microsoft to seek support from Microsoft on these newsgroups, but when someone posts a difficult question it goes unanswered. So what are we supposed to do? Regards, Matt [quoted text, click to view] "Matt Garven" <no@spam.com> wrote in message news:eus2w%23X9EHA.3820@TK2MSFTNGP11.phx.gbl... > Hi Chris, > > Thanks for the suggestion, however we don't use > Application.EnableVisualStyles at all. > > Regards, > Matt > > "Chris" <dunawayc@gmail.com> wrote in message > news:1105125407.386508.56920@f14g2000cwb.googlegroups.com... > > I recently experienced an exception similar to this and determined that > > we made calls to EnableVisualStyles in more than on place. When we > > removed the duplicate calls, the exception went away. > > This might be your problem, but it is worth a shot. > > > > Chris > > > >
Don't see what you're looking for? Try a search.
|