For Programmers: Free Programming Magazines  


Home > Archive > C# > January 2006 > [Possible glitch/bug in COM-.Net interop] Windows Form with IE Webbrowser control thr









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [Possible glitch/bug in COM-.Net interop] Windows Form with IE Webbrowser control thr
programmingq@gmail.com

2005-10-07, 9:57 pm

We have a windows application(MDI) written in C#.Net, which has an IE
Webbrowser control embedded in the page. Dialog opened could be a .Net
form with a web browser control or can be an independent IE window
opened from the web application hosted in the browser control of the
parent windows form. This application runs fine for a good 4-5 hours
and then crashes after throwing exceptions, which seem to be coming
from the COM component. We are primarily observing 3 kinds of
exceptions before the application crashes. I went through a few
knowledgebases and did not find a solution which would be applicable to
us. We are not able to recreate these issues on our development or
testing boxes. I used perfmon counters to see the behavior of the
process. Number of GC handles increased before the crash. I do not
understand why the number would increase all of a sudden and then just
crash. It seems like in some cases either CCW is invalid or RCW is
invalid due to something funky in GC.

--> We are not using Application.EnableVisualStyles
--> We are not invoking GC.Collect()
--> We are releasing the COM object in the dispose method of the
windows form.
--> To the best of my knowledge, we are reregistering the events of the
browser everytime.
--> We have activex controls in our webapplication.
--> Windows form has a datagrid with custom column style.

Any suggestions?

Exception 1:
Exception Message : COM object that has been separated from its
underlying RCW can not be used. **Exception Stack Trace : at
SHDocVw.IWebBrowser2.get_Document()
at AxSHDocVw.AxWebBrowser.get_Document()

Exception 2:
An unhandled exception of type 'System.NullReferenceException' occurred
in system.windows.forms.dll

Additional information: Object reference not set to an instance of an
object.

Unhandled Exception: System.NullReferenceException: Object reference
not set to an instance of an object.
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms. UnsafeNativeMethods+IMsoComponentManager
.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)

Exception 3:
************** Exception Text **************
System.Runtime.InteropServices.SEHException: External component has
thrown an exception.
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)


I was wondering if it is a bug or an issue with .Net-COM
Interoperability. Did anyone have similar issues? Any information in
this regard would be pretty helpful.

Thanks,
VC.

tef

2006-01-27, 1:48 pm

I am having the same problem with a C#/.Net app. The embedded webbrowser control seems to cause unhandled exceptions of the same types you listed. Sometimes our application closes completely. I can not seem to find a solution. Have you found one?


[QUOTE]Originally posted by programmingq@gmail.com
[B]We have a windows application(MDI) written in C#.Net, which has an IE
Webbrowser control embedded in the page. Dialog opened could be a .Net
form with a web browser control or can be an independent IE window
opened from the web application hosted in the browser control of the
parent windows form. This application runs fine for a good 4-5 hours
and then crashes after throwing exceptions, which seem to be coming
from the COM component. We are primarily observing 3 kinds of
exceptions before the application crashes. I went through a few
knowledgebases and did not find a solution which would be applicable........
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com