我正在尝试使用Spring.NET和C#为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,在更新的版本中这是可能的吗(我们很快就会迁移到它)?
更新:在实验之后,我得到了这个相同的错误,参数略有不同(即。UnmanagedType 44)。
发布于 2010-12-21 08:49:33
这似乎是在为代理方法:https://issues.springsource.org/browse/SPRNET-852?page=com.atlassian.streams.streams-jira-plugin%3Aactivity-stream-issue-tab生成属性时,Spring.NET 1.1中的一个错误造成的。我们有一个迁移到最新Spring版本的测试解决方案,所以我在那里进行了测试。啊,真灵。
https://stackoverflow.com/questions/3780529
复制相似问题