[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

vb.net app does not end with COM interop

JR

10/24/2007 3:20:00 AM

I am new to .net programming. I have some COM objects that are served by an
MFC dll that were originally developed with VS6.0. I have recently been
upgrading them to use VS .NET 2003 (keeping them in an MFC dll). I created a
simple VB.NET application to test one of the objects and the application does
not terminate...the process remains active although the form has been closed.

Here is the basic logic:
----------------------------------------------------------
Dim Conn1 as gf1dll.Connector

Private Sub Form1_Load(...)
Conn1 = new gf1dll.Connector
End Sub
Private Sub Form1_Disposed(...)
If Not Conn1 Is Nothing Then
Marshal.ReleaseComObject(Conn1)
End If
End Sub
----------------------------------------------------------

I've also tried the ReleaseComObject in the Form1_Closed event
I've also tried setting the Conn1 object = Nothing (in lieu of the
ReleaseComObject)

When I debug my COM object, the object's OnFinalRelease() method is called,
but its destructor is never called. I assusme this is the reason that the
app hangs.

So, why is the destructor not called? Am I doing something wrong? Is the
COM interop just not a good idea for my setup?

Thanks,
Jeremy