Code Comments
Programming Forum and web based access to our favorite programming groups.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.UnsafeNativeMetho ds+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.
Post Follow-up to this messageI am having the same problem with a C#/.Net app. The embedded webbrowser con trol seems to cause unhandled exceptions of the same types you listed. Some times 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........
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.