Re: .NET Component called from COM Component not released
- From: "Phil Wilson" <Phil.Wilson@xxxxxxxxxxxxxx>
- Date: Thu, 2 Jun 2005 11:15:39 -0700
A couple or three ideas in no particular order.
piLogger=NULL;
I haven't stepped through that or looked at the code - does it call Release
on the wrapped interface pointer?
In the Console.NET client - see if Marshal.ReleaseComObject helps release
from the bottom up.
In the ATL component, if you want to free idle DLLs, see if
CoFreeUnusedLibraries helps.
You won't get Dispose called - who's going to call it? I don't believe that
COM client wrappers look for IDisposable, so if it's important expose it as
a method.
--
Phil Wilson [MVP Windows Installer]
----
"wschaub" <wschaub@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:54027790-005E-478A-ADAB-A988D1A7AA2B@xxxxxxxxxxxxxxxx
> We have a test environment in which we instantiate a COM/ATL/C++ component
> from a Managed/Console/.NET/C# application. The COM component in turn
> instantiates and calls a .NET/C#/Class Library component using Interop as
> below:
>
> #import "demologger.tlb" raw_interfaces_only named_guids no_namespace
> // log using .NET Interop
> CComPtr<IDemoLogger> pILogger;
> bstr_t bstrMessage = "Hello from COM to .NET";
>
> hResult = pILogger.CoCreateInstance ( CLSID_DemoLogger,
> NULL,
> CLSCTX_SERVER );
> if ( 0 == hResult ) pILogger->LogToFile ( bstrMessage );
> else return S_FALSE;
>
> // We are done
> pILogger = NULL;
>
> Even if this logic and the CComPtr go out of scope and the reference count
> is decremented, neither the destructor or the Dispose methods of the .NET
> component are called. How can we ensure/enforce disposal or components
> used
> via Interop?
>
> Flow is:
>
> Console/.NET ---> COM/ATL component ---> .NET Component
.
- Prev by Date: Re: Developing for later (2003) version of Excel
- Next by Date: Re: Please help me call this function from C#
- Previous by thread: Re: .NET Component called from COM Component not released
- Next by thread: CAPICOM "How do we sign binary data"
- Index(es):
Relevant Pages
|