2010-09-23 45 views
1

我正在尝试使用Spring.NET和C#为COM接口创建一个动态代理。我目前正在尝试使用代码,而不是配置文件。 我有类似下面的代码:是否可以使用Spring.Net代理COM接口?

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

它在GetProxy炸毁()有以下例外拨打:

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)] 

这是根本不可能的?我仍然在使用Spring.NET 1.1,这是否可以在新版本中使用(我们最终将尽快推出)?

更新:经过试验,我也得到了这个相同的错误,当代理Form类时也有一些不同的参数(即UnmanagedType 44)。

回答

相关问题