Repost: UnsafeNativeMethods.CallWindowProc NullReferenceException

G

Guest

(apologies for the repost, I believe we've got our MSDN subscriber passport
correctly associated with our no-spam alias this time)

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
 
J

Jeffrey Tan[MSFT]

Hi Matt,

Thanks for your posting!!

For your issue, I see that you pasted 2 stacktraces, but I still can not
reproduce out your issue. There can be many causes to this issue, I think
you may first help me to reproduce out your issue, then I can identify the
cause of this issue.

Can you give us some detailed problem context description? Also, any
reproduce steps can help us to understand the problem. At last, you can
also create a simple sample project for us to reproduce this issue.

I will wait for your further feedback. Thanks.
===================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi Jeffrey,

Thanks for the reply. Reproducing the issue is hard, this problem seems to
happen most often at client sites and not from any clearly defined sequence
of events. I also suspect it only occurs in release mode which is why we
don't see it here on the developer machines.

Our application is 1.9 million lines of code, producing a sample app would
be difficult - I wish I could narrow it down to a particular control or form
but I haven't had any luck so far.

Perhaps you might be able to provide some suggestions for tracking the issue
down? Or some additional code I could put into the application to narrow the
list of possible causes or give us a clue where to start looking?

Thanks for your assistance.

Regards,
Matt Garven
 
J

Jeffrey Tan[MSFT]

Hi Matt,

Thanks for your feedback.

For this issue, I think it is really very hard to track the cause point.
And I also did not have very good suggestion on tracking this issue. I
think you may use WinDbg with SOS extension to debug your product, below
are some useful resource for how to use WinDbg and SOS:

"Production Debugging for .NET Framework Applications"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
dbgch02.asp
"SOS: It's Not Just an ABBA Song Anymore"
http://msdn.microsoft.com/msdnmag/issues/03/06/Bugslayer/default.aspx
"Traversing the gc heap (and introducing PSSCOR.DLL)"
http://blogs.msdn.com/mvstanton/archive/2004/04/05/108023.aspx
"Troubleshooting ASP.NET using WinDbg and the SOS extension"
http://www.support.microsoft.com/kb/892277
"SOS Debugging of the CLR, Part 1"
http://blogs.msdn.com/jasonz/archive/2003/10/21/53581.aspx

If you still can not figure out this issue and need more help on it,
looking at the nature of this issue, it would require intensive
troubleshooting which would be done quickly and effectively with direct
assistance from a Microsoft Support Professional through Microsoft Product
Support Services. You can contact Microsoft Product Support directly to
discuss additional support options you may have available, by contacting us
at 1-(800)936-5800 or by choosing one of the options listed at
http://support.microsoft.com/default.aspx?scid=sz;en-us;top. If this is not
an urgent issue and your would like us to create an incident for you and
have Microsoft Customer Service Representative contact you directly,
please send email to (remove "online." from this no Spam email address):
mailto:[email protected] with the following information,
*Include "Followup: <Tomcat IssueID>" in the email Subject.
*Location of the post
*Subject Line
*First Name, Last Name
*MSDN Subscriber ID
*Company name (if any)
*Phone number
*e-mail address

Hope this makes sense to you.
====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi Jeffrey,

Thanks for the links, however I'm already familiar with using WinDBG and SOS.

I'll send the email as you've suggested, however i'm not sure what a Tomcat
IssueID is.

Thanks again for your help.

Regards,
Matt Garven
 
J

Jeffrey Tan[MSFT]

Hi Matt,

Oh, I think there is no need for you to send an email to
(e-mail address removed), once you have contacted PSS through that
phone number or Link address, everything will be alright. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi Jeffrey,

The link you provided is giving me a "Page Not Found" error, and the number
you gave me is for US support I think. I'm in Australia.

Regards,
Matt Garven
 
J

Jeffrey Tan[MSFT]

Hi Matt,

Oh, yes, it seems that Link is not available now. You may directly visit
http://www.microsoft.com/services/microsoftservices/supp.mspx, then choose
a support type for your issue.

For the telephone support, I suggest you look for your MSDN disk, which
should document your local Australia Microsoft PSS phone number.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

John Carroll via DotNetMonster.com

I don't know if this will help anyone, but I have managed to get a solid
failure. The common denominator was setting the multiline property of a
TextBox to true. Failures originated in the set_height and set_text
methods. Setting the multiline property to false eliminated 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