.NETGURU
Random exceptions in Windows Forms app
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.windowsforms.

Post a new message to this list...

Brian Eng
We are working on a large project that has several owner-drawn controls and
interacts with a couple of COM components (not ActiveX controls). At
seemingly random times, we receive (usually) a NullReferenceException.
Occasionally, it is a "External component has thrown an exception".
Regardless of the type of exception, we get the following stack trace:

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 QA team has been unable to find a reproducable path. Any ideas?
Reply to this message...
 
    
Sijin Joseph
Ensure that your windows form App and them COM compoenents are using
compatible Threading models. By default all winform apps use the STA
threading model. If your COM components are MTA threaded then you could such
kind of exceptions.

--
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

"Brian Eng" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> We are working on a large project that has several owner-drawn controls
and
[Original message clipped]

Reply to this message...
 
    
Brian Eng
Thanks for your reply. That is really interesting... Unfortunately, our
WinForms app and all COM components are STA. Any other ideas?

"Sijin Joseph" wrote:

[Original message clipped]

Reply to this message...
 
    
Brian Eng
Ok, we are getting to the root of the problem. We are using Spy++ to view
the parked window handles that are being created by our application. It
seems that when you create a panel that is not initially visible, its child
controls are initially parked. When you then close the containing form,
those child controls are not properly disposed. Anyone seen this before?

"Brian Eng" wrote:

[Original message clipped]

Reply to this message...
 
    
Charles Collins
I have an application that is throwing the same error, but only when run
through terminal server. We have yet to see it in any other instance and it
is totally random and sporadic. A solution to this issue would be greatly
welcomed here too.

"Brian Eng" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.IntPtr
System.NullReferenceException
System.Windows.Forms.ContainerControl
System.Windows.Forms.Control
System.Windows.Forms.NativeWindow
System.Windows.Forms.ScrollableControl




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification