.NET Component called from COM Component not released
- From: "wschaub" <wschaub@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 30 May 2005 03:15:09 -0700
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
.
- Follow-Ups:
- Re: .NET Component called from COM Component not released
- From: Fakher Halim
- Re: .NET Component called from COM Component not released
- Prev by Date: Re: Prevent a field from being marshaled?
- Next by Date: RE: C# client passing a string to C++ server
- Previous by thread: Calling C++ from C# Part 2
- Next by thread: Re: .NET Component called from COM Component not released
- Index(es):
Relevant Pages
|