0

プロセス外の .Net DLL を作成しようとしています。サンプルコードを使用して、プロセス外の COM DLL を作成できました。ただし、イベント処理の実装中にいくつかの問題に直面しています。

コードに従って、次のイベントがコンポーネントによって公開されます。

Public Event FloatPropertyChanging(ByVal NewValue As Single, ByRef Cancel As Boolean)

VB.Net フォーム アプリケーションでそのイベントを処理すると、例外がスローされます。詳細は次のとおりです。

Dim tempObj As New VBServicedComponent.SimpleObject()

AddHandler tempObj.FloatPropertyChanging, AddressOf FloatPropertyChangingEventHandler // **Throws Exception!!!**
tempObj.FloatProperty = 4

例外の詳細:

System.Reflection.TargetInvocationException:-
Exception has been thrown by the target of an invocation

スタックトレース:

System.RuntimeMethodHandle.SerializationInvoke (IRuntimeMethodInfo メソッド、オブジェクト ターゲット、SerializationInfo 情報、StreamingContext& コンテキスト) で System.Runtime.Serialization.ObjectManager.CompleteISerializableObject (オブジェクト obj、SerializationInfo 情報、StreamingContext コンテキスト) で System.Runtime.Serialization.ObjectManager.FixupSpecialObject ( System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) at System.EnterpriseServices. System.EnterpriseServices の System.EnterpriseServices.ComponentServices.ConvertToMessage(String s、オブジェクト tp) の ComponentSerializer.UnmarshalFromBuffer(Byte[] b、オブジェクト tp)。System.EnterpriseServices.ServicedComponent.System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(String s) の ServicedComponent.RemoteDispatchHelper(String s, Boolean& failed) System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(String s) の System.EnterpriseServices.RemoteServicedComponentProxy.Invoke(IMessage D:\Meridia\MeridiaAPI\COMPlusServices\TestApp の TestApp.modMain.Main() で\Module1.vb:34行目System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(String s) の System.EnterpriseServices.RemoteServicedComponentProxy.Invoke(IMessage reqMsg) の RemoteDispatchNotAutoDone(String s) System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData、Int32 型) の VBServicedComponent .SimpleObject.add_FloatPropertyChanging(FloatPropertyChangingEventHandler obj) at TestApp.modMain.Main() in D:\Meridia\MeridiaAPI\COMPlusServices\TestApp\Module1.vb:line 34System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(String s) の System.EnterpriseServices.RemoteServicedComponentProxy.Invoke(IMessage reqMsg) の RemoteDispatchNotAutoDone(String s) System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData、Int32 型) の VBServicedComponent .SimpleObject.add_FloatPropertyChanging(FloatPropertyChangingEventHandler obj) at TestApp.modMain.Main() in D:\Meridia\MeridiaAPI\COMPlusServices\TestApp\Module1.vb:line 34add_FloatPropertyChanging(FloatPropertyChangingEventHandler obj) at TestApp.modMain.Main() in D:\Meridia\MeridiaAPI\COMPlusServices\TestApp\Module1.vb:line 34add_FloatPropertyChanging(FloatPropertyChangingEventHandler obj) at TestApp.modMain.Main() in D:\Meridia\MeridiaAPI\COMPlusServices\TestApp\Module1.vb:line 34

内部例外:

Could not load file or assembly 'TestApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"TestApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

スタックトレース:

System.Reflection.RuntimeAssembly._nLoad (AssemblyName fileName、Evidence assemblySecurity、RuntimeAssembly locationHint、StackCrawlMark& stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean forIntrospection、Boolean suppressSecurityChecks) で System.Reflection.RuntimeAssembly.InternalLoadAssemblyName (AssemblyName assemblyRef、Evidence assemblySecurity 、RuntimeAssembly reqAssembly、StackCrawlMark& stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString、Evidence assemblySecurity、StackCrawlMark& stackMark、IntPtr pPrivHostBinder、Boolean forIntrospection) で System.Reflection.RuntimeAssembly.RuntimeAssembly.RuntimeAssembly.InternalLoad InternalLoad(String assemblyString, 証拠 assemblySecurity,System.Reflection.MemberInfoSerializationHolder..ctor(SerializationInfo 情報、StreamingContext コンテキスト) で System.Runtime.Serialization.FormatterServices.LoadAssemblyFromString(String assemblyName) で System.Reflection.Assembly.Load(String assemblyString) で StackCrawlMark& stackMark、Boolean forIntrospection)

イベントの処理中に TestApp の終了時に欠けているものはありますか? はいの場合、そのようなイベントを処理する適切な方法は何ですか?

前もって感謝します。

4

0 に答える 0