First and foremost, please excuse my lack of .NET knowledge, my experience is all Win32API/C/C++/COM.

With that being said I've built a simple COM Object that contains nested objects.

For example:

Garage Object, Garage object has a property "Cars".

Cars is a collection of Car objects.

Now the trick here is that the COM object caller won't know how many cars are in the "garage" until they call the "Cars" property. This property returns a CarsCollection, which we enumerate to get all the Cars. The CarsCollection is a Collection of Car objects allocated by the Garage object, all handled inside of COM.

This works perfectly in vbscript with our COM object..

However, when I call the same process from .NET we get an System.AccessViolationException when trying to access the CarsCollection. I'm assuming this is due to managed code access memory allocated via COM unmanaged.

But, I'm hoping a .NET guru can give me some suggestions.

Thanks!

h