M
Marcello G.
I'm begginin to works with the compact framework but I found a a
problem that's making me crazy
I need to invoke a metoth from ax external assembly (a .dll), I open
the assembly, create the object, retrive the proper method, but the
invoke command raise an error.
The stange thing i thate the, the same code (with the same external
assemby copied to the emulator) works porperly in .NET framewok.
Can you please help me!
Here is my code :
Private Sub ExecuteMenuCommand(ByVal DLLName As String, ByVal
PlugInName As String, ByVal MethodName As String)
' Esecuzione di un comando del menù
Dim PIType As Type
Dim OPlugIn As Object
Try
' Apre la DLL
Dim APlugIn As [Assembly] =
[Assembly].LoadFrom(DLLName)
' Estrae il tipo del plugin e lo istanzia
PIType = APlugIn.GetType(PlugInName)
OPlugIn = Activator.CreateInstance(PIType)
' Istanzia l'oggetto PlugIn
Dim mi As MethodInfo = PIType.GetMethod(MethodName)
mi.Invoke(OPlugIn, Nothing) <========= Here
is the error
Catch ex As Exception
MessageBox.Show("Errore nell'esecuzione del comando '"
& MethodName & "' nel PlugIn '" & "' : " & vbCrLf & ex.ToString())
End Try
End Sub
And here is the error desccription :
"System.MissingMethodException: File or assembly name
'Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A', or one of its dependencies, was not
found.
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.Invoke()
at System.Reflection.MethodBase.Invoke()
at DynMenuItem.ExecuteMenuCommand()
at DynMenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DeviceApplication1.Prova.Main()
Thanks
Marcello
problem that's making me crazy
I need to invoke a metoth from ax external assembly (a .dll), I open
the assembly, create the object, retrive the proper method, but the
invoke command raise an error.
The stange thing i thate the, the same code (with the same external
assemby copied to the emulator) works porperly in .NET framewok.
Can you please help me!
Here is my code :
Private Sub ExecuteMenuCommand(ByVal DLLName As String, ByVal
PlugInName As String, ByVal MethodName As String)
' Esecuzione di un comando del menù
Dim PIType As Type
Dim OPlugIn As Object
Try
' Apre la DLL
Dim APlugIn As [Assembly] =
[Assembly].LoadFrom(DLLName)
' Estrae il tipo del plugin e lo istanzia
PIType = APlugIn.GetType(PlugInName)
OPlugIn = Activator.CreateInstance(PIType)
' Istanzia l'oggetto PlugIn
Dim mi As MethodInfo = PIType.GetMethod(MethodName)
mi.Invoke(OPlugIn, Nothing) <========= Here
is the error
Catch ex As Exception
MessageBox.Show("Errore nell'esecuzione del comando '"
& MethodName & "' nel PlugIn '" & "' : " & vbCrLf & ex.ToString())
End Try
End Sub
And here is the error desccription :
"System.MissingMethodException: File or assembly name
'Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A', or one of its dependencies, was not
found.
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.Invoke()
at System.Reflection.MethodBase.Invoke()
at DynMenuItem.ExecuteMenuCommand()
at DynMenuItem.OnClick()
at System.Windows.Forms.Menu.ProcessMnuProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DeviceApplication1.Prova.Main()
Thanks
Marcello