COMインターフェイスにSpring.NETとC#を使用して動的プロキシを作成しようとしています。私は現在、設定ファイルではなくコードを使用して実験しています。私は次のようなコードを持っています:
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.NET1.1を使用していますが、これは新しいバージョンで可能ですか(これはまもなく移行されます)?
更新:実験した後、Formクラスをプロキシするときにも、わずかに異なるパラメーター(つまり、UnmanagedType 44)で同じエラーが発生しました。