Wavemachine
March 11th, 2003, 07:24 AM
I have a problem when using com interop and trying to do any UI work using Windows forms or even a message box.
The COM object is a class library written in C# using Visual studio 7. The Client is an MFC Application written using VC 6.0.
All is fine untill I exit the App and then I get an assertion on Line 52 of CmdTarget.cpp which is a reference counting problem.
If I comment out the message box in the C# code the assert does not appear, similarly if I force a garbage collect all is okay.
The problem with the client does not occur if I remove the AfxOleInit an do a CoInitialize instead however our main project does need the OLE DLL's loaded to work correctly with the libraries it uses.
Any idea's will be appreciated as this is getting very critical now.
I have attached a sample that will illustrate the problem.
Thanx
Dave
The COM object is a class library written in C# using Visual studio 7. The Client is an MFC Application written using VC 6.0.
All is fine untill I exit the App and then I get an assertion on Line 52 of CmdTarget.cpp which is a reference counting problem.
If I comment out the message box in the C# code the assert does not appear, similarly if I force a garbage collect all is okay.
The problem with the client does not occur if I remove the AfxOleInit an do a CoInitialize instead however our main project does need the OLE DLL's loaded to work correctly with the libraries it uses.
Any idea's will be appreciated as this is getting very critical now.
I have attached a sample that will illustrate the problem.
Thanx
Dave