代码之家  ›  专栏  ›  技术社区  ›  Matt H

可以使用代理COM接口Spring.Net?

  •  1
  • Matt H  · 技术社区  · 16 年前

    我正在尝试使用弹簧.NETC#表示COM接口。我目前正在尝试使用代码,而不是配置文件。 我的代码如下:

    Type comInterfaceType = typeof(ICOMInterface);
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.AddInterface(comInterfaceType);
    proxyFactory.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)]
    

    难道这根本不可能吗?我还在用弹簧.NET1.1,在较新的版本中是否有可能实现这一点(我们最终将很快转向该版本)?

    1 回复  |  直到 16 年前
        1
  •  0
  •   Matt H    15 年前

    似乎这是一个错误的结果弹簧.NET1.1为代理方法生成属性时: https://issues.springsource.org/browse/SPRNET-852?page=com.atlassian.streams.streams-jira-plugin%3Aactivity-stream-issue-tab . 我们有一个测试迁移到最新Spring版本的解决方案,所以我在那里测试了这个。成功了。

    推荐文章