I have a treeview inside a VB.NET form, however, as soon as the form is closed and the Main() methods finishes I get the following exception:
COM object that has been separated from its underlying RCW cannot be used
If the treeview.nodes.Add() method is executed (to add nodes) the exception is thrown. If I Comment out that single line, the exception is not thrown.
Any idea?
There's no source code. The entire exception says:
A first chance exception of type 'System.Runtime.InteropServices.InvalidComObjectException' occurred in Unknown Module. System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>ClinicTracker.vshost.exe</AppDomain><Exception><ExceptionType>System.Runtime.InteropServices.InvalidComObjectException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>COM object that has been separated from its underlying RCW cannot be used.</Message><StackTrace> at System.StubHelpers.StubHelpers.StubRegisterRCW(Object pThis) at System.Windows.Forms.UnsafeNativeMethods.IOleInPlaceObject.GetWindow(IntPtr& hwnd) at System.Windows.Forms.AxHost.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</StackTrace><ExceptionString>System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used. at System.StubHelpers.StubHelpers.StubRegisterRCW(Object pThis) at System.Windows.Forms.UnsafeNativeMethods.IOleInPlaceObject.GetWindow(IntPtr& hwnd) at System.Windows.Forms.AxHost.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</ExceptionString></Exception></TraceRecord>
|