Search:
Namespaces
Discussions
.NET v1.1
Feedback
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com