Testing COM components in .NET

Rajaat

Member
Joined
Sep 11, 2003
Messages
8
Location
Corvallis, OR
I need to test a number of COM components and I have two options:
  1. test using unmanaged C++
  2. test using .NET managed language
I prefer option 2 due to the simpicity envolved with with creating the objects and calling the methods. Unfortunately, .NET makes it difficult to test all possible posibilities.

Here is a simple example of what I mean. Suppose I have an interface with the following method:

Code:
[object, uuid(...), pointer_default(unique)]
interface ICollection : IDispatch
{
    [propget, id(...)] HRESULT Count([out, retval] long *pVal);
}

.NET will conveniently allow me to access Count the following way:
Code:
// In C#
ICollection c = new CollectionClass();
long count = c.Count;

Ok, Here is my problem. In the C++ COM implementation there is code to make sure that pVal points to a real location; in other words, that the pointer is not null. I cant make pVal null in .NET.

I noticed (through IntelliSense) some raw_ methods that seemed to allow me to access the COM signature for some methods under managed C++ but these raw_ methods were available only for COM methods and not COM properties.

Im trying to find information on this so that I can understand what my options are. Any suggestions, comments, or strategies would be appreciated!
 
Back
Top