How to intentionally do interop like this: Managed->CCW->RCW->Managed  
Author Message
TonySeattle





PostPosted: Common Language Runtime, How to intentionally do interop like this: Managed->CCW->RCW->Managed Top

VS2005 prevents me from adding a reference to a type library that was exported from a .NET assembly. A message pops up that says "The ActiveX type library was exported from a .NET assembly and cannot be added as a reference, add a reference to the .NET assembly instead."

The message makes perfect sense, because it would be foolish to take the performance hit of going through a COM interface when you could have just stuck with managed code.

But my situation is different. It's my job to TEST the COM interface in a product that is written with managed code, and I need to use managed code to drive the testing. If I don't use the COM interface, then I'm not really testing it.

So, after extensive effort, I still don't have a good solution. It seems like I should be able to go: Managed Code -> COM interop(CCW) -> COM interop(RCW) -> Managed Code. But all the tools I can find prevent me from doing it, (apparently, to stop me from taking an unnesseccary performance hit).

I'm able to think of sloppy work arounds that will dramatically increase the workload, (like writing an unmanaged go-between), but this is going to be a BIG job, and it's worth taking the time to figure out an elegant way to proceed.

Is there some underlying technical reason that it would not be possible to use a CCW from a RCW If it can be done, how What are my options for proceeding

-tony



.NET Development24