views:

23

answers:

0

I am trying to create a dynamic proxy using Spring.NET and C# for a COM interface. I am currently experimenting using code, not config files. I have code similar to the following:

Type comInterfaceType = typeof(ICOMInterface);
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.AddInterface(comInterfaceType);
proxyFactory.GetProxy();

It blows up at the GetProxy() call with the following exception:

System.InvalidOperationException: The property with name ArraySubType can't be found 
    in the type System.Runtime.InteropServices.MarshalAsAttribute, but is present as 
    a named property on the attributeData 
[System.Runtime.InteropServices.MarshalAsAttribute(
    (System.Runtime.InteropServices.UnmanagedType)28, ArraySubType = 0, SizeParamIndex
    = 0, SizeConst = 0, IidParameterIndex = 0, SafeArraySubType = 0)]

Is this simply not possible? I am still using Spring.NET 1.1, is this possible in the newer versions (which we will finally be moving to soon)?

UPDATE: After experimenting, I got this same error with slightly different parameters (ie. UnmanagedType 44) when proxying the Form class as well.