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