Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2006

Tip: Looking for answers? Try searching our database.

NullReferenceException in Windows.FormsUnsafeNativeMethods.CallWindowProc in .NET 1.1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stan Huff - 26 Jan 2006 21:15 GMT
I have a stack trace of a NullReferenceException and the only code in the
stack trace is from System.Window.Forms.

System.NullReferenceException: Object reference not set to an instance of an
object.
  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)

Can someone tell me how this can happen?  Also, how can a PInvoke method
such as CallWindowProc ever raise this exception? One of our employees ran
into this using Windows XP embedded in a production facility.  I can't be
sure of what was happening exactly when this occurred.  Such exceptions are
automatically sent to me via email when they occur.

Thanks,
Stan
SP - 28 Jan 2006 04:43 GMT
>I have a stack trace of a NullReferenceException and the only code in the
> stack trace is from System.Window.Forms.
[quoted text clipped - 17 lines]
>
> Can someone tell me how this can happen?

Check you are disposing all forms that you open in the application after
they are closed.

SP

 Also, how can a PInvoke method
> such as CallWindowProc ever raise this exception? One of our employees ran
> into this using Windows XP embedded in a production facility.  I can't be
[quoted text clipped - 4 lines]
> Thanks,
> Stan
Stan Huff - 30 Jan 2006 16:23 GMT
I always include form constructions in "using" statements such as:

using (Form frm = new Form()) {
}

As such, I believe they are always being disposed immediately after use.

Stan

> >I have a stack trace of a NullReferenceException and the only code in the
> > stack trace is from System.Window.Forms.
[quoted text clipped - 32 lines]
> > Thanks,
> > Stan

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.