A complex one.....
-
... Prepare for confusion, but please help. I have a plugin framework, using reflection. This works brilliantly and I will release the code eventually. However, one of the plugins is calling an async callback. This throws an invokation exception:
Cannot load type GoogleSearch.GoogleSearchForm, GoogleSearch, Version=1.0.1212.26393, Culture=neutral,
PublicKeyToken=null. at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod()
at System.Runtime.Remoting.Messaging.MethodCall..ctor(IMessage msg, Boolean needAccessCheck)
at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem..ctor(IMethodCallMessage message, AsyncResult ar, Object target)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at GoogleSearch.SearchDelegate.BeginInvoke(String url, String& result, AsyncCallback callback, Object object)
at GoogleSearch.GoogleSearchForm.search_Click(Object sender, EventArgs e)
in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screenmate\googlesearch\google.cs:line 219
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods
+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at GoogleSearch.GooglePlugin.LoadGoogleForm()
in c:\documents and settings\administrator.jonny\my documents\visual studio projects\scree -
... Prepare for confusion, but please help. I have a plugin framework, using reflection. This works brilliantly and I will release the code eventually. However, one of the plugins is calling an async callback. This throws an invokation exception:
Cannot load type GoogleSearch.GoogleSearchForm, GoogleSearch, Version=1.0.1212.26393, Culture=neutral,
PublicKeyToken=null. at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod()
at System.Runtime.Remoting.Messaging.MethodCall..ctor(IMessage msg, Boolean needAccessCheck)
at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem..ctor(IMethodCallMessage message, AsyncResult ar, Object target)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at GoogleSearch.SearchDelegate.BeginInvoke(String url, String& result, AsyncCallback callback, Object object)
at GoogleSearch.GoogleSearchForm.search_Click(Object sender, EventArgs e)
in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screenmate\googlesearch\google.cs:line 219
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods
+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at GoogleSearch.GooglePlugin.LoadGoogleForm()
in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screeYou are likely having a threading issue. Try as the AsyncCallback is invoked from another thread. Do the following: from your control: Invoke(mi.Invoke, new object[]{o, new object[]{rect}}); Eek. Dunno if that will work, but give it a try :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
-
You are likely having a threading issue. Try as the AsyncCallback is invoked from another thread. Do the following: from your control: Invoke(mi.Invoke, new object[]{o, new object[]{rect}}); Eek. Dunno if that will work, but give it a try :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
I'm not sure I understand where i'm to place that. The plugin is activated and invoked from a form in the main app and main thread. From the new instance of the plugin, the plugin class loads the plugin form. object o = Activator.CreateInstance(t); MethodInfo mi = t.GetMethod("SomeMethod"); mi.Invoke(o,null); does the above code create the instance of the object in a new thread, or the same thread as the method that runs it?
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- Anon
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^]
-
I'm not sure I understand where i'm to place that. The plugin is activated and invoked from a form in the main app and main thread. From the new instance of the plugin, the plugin class loads the plugin form. object o = Activator.CreateInstance(t); MethodInfo mi = t.GetMethod("SomeMethod"); mi.Invoke(o,null); does the above code create the instance of the object in a new thread, or the same thread as the method that runs it?
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- Anon
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^]
Jonny Newman wrote: does the above code create the instance of the object in a new thread, or the same thread as the method that runs it? That will create the object in the calling thread. I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
-
... Prepare for confusion, but please help. I have a plugin framework, using reflection. This works brilliantly and I will release the code eventually. However, one of the plugins is calling an async callback. This throws an invokation exception:
Cannot load type GoogleSearch.GoogleSearchForm, GoogleSearch, Version=1.0.1212.26393, Culture=neutral,
PublicKeyToken=null. at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod()
at System.Runtime.Remoting.Messaging.MethodCall..ctor(IMessage msg, Boolean needAccessCheck)
at System.Runtime.Remoting.Proxies.AgileAsyncWorkerItem..ctor(IMethodCallMessage message, AsyncResult ar, Object target)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at GoogleSearch.SearchDelegate.BeginInvoke(String url, String& result, AsyncCallback callback, Object object)
at GoogleSearch.GoogleSearchForm.search_Click(Object sender, EventArgs e)
in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screenmate\googlesearch\google.cs:line 219
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods
+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at GoogleSearch.GooglePlugin.LoadGoogleForm()
in c:\documents and settings\administrator.jonny\my documents\visual studio projects\screeJonny Newman wrote: Anyway, the above code WORKED PERFECTLY when it was not a plugin and was just a compile time dll. The only thing i've changed is the fact that the form is being run from a late-binding dll. Just judging from that I would say there is a problem with the application resolving assemblies. In the FrameworkSDK\bin directory (located within VS.NET's install folder) you'll find FUSLOGVW.exe which will let you see what the runtime is trying to do to find the assemblies it needs to load. Run that, make sure you check the "Log Failures" checkbox, then run your application. You should see where it is expecting to find the assemblies it is loading, and if it fails to load an assembly the plugin depends on. HTH, James "It is self repeating, of unknown pattern" Data - Star Trek: The Next Generation
-
Jonny Newman wrote: Anyway, the above code WORKED PERFECTLY when it was not a plugin and was just a compile time dll. The only thing i've changed is the fact that the form is being run from a late-binding dll. Just judging from that I would say there is a problem with the application resolving assemblies. In the FrameworkSDK\bin directory (located within VS.NET's install folder) you'll find FUSLOGVW.exe which will let you see what the runtime is trying to do to find the assemblies it needs to load. Run that, make sure you check the "Log Failures" checkbox, then run your application. You should see where it is expecting to find the assemblies it is loading, and if it fails to load an assembly the plugin depends on. HTH, James "It is self repeating, of unknown pattern" Data - Star Trek: The Next Generation
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v1.0.3705\fusion.dll
Running under executable C:\Documents and Settings\Administrator.JONNY\My Documents\Visual Studio Projects\ScreenMate\ScreenMate\bin\Debug\ScreenMate.exe
--- A detailed error log follows.=== Pre-bind state information ===
LOG: DisplayName = GoogleSearch, Version=1.0.1212.29205, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\Administrator.JONNY\My Documents\Visual Studio Projects\ScreenMate\ScreenMate\bin\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: GoogleSearch, Version=1.0.1212.29205, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch/GoogleSearch.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch/GoogleSearch.EXE.
LOG: All probing URLs attempted and failed.Well, it seems to state that the dll was never loaded. However, the dll must have been loaded because the form the button is on is in that dll, code is actually being run from it. It is definately something to do with the async callback. Should I try starting the Activator.CreateInstance() in another thread? Threading isn't my strong point.
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- A -
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v1.0.3705\fusion.dll
Running under executable C:\Documents and Settings\Administrator.JONNY\My Documents\Visual Studio Projects\ScreenMate\ScreenMate\bin\Debug\ScreenMate.exe
--- A detailed error log follows.=== Pre-bind state information ===
LOG: DisplayName = GoogleSearch, Version=1.0.1212.29205, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = C:\Documents and Settings\Administrator.JONNY\My Documents\Visual Studio Projects\ScreenMate\ScreenMate\bin\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).LOG: Processing DEVPATH.
LOG: DEVPATH is not set. Falling through to regular bind.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: GoogleSearch, Version=1.0.1212.29205, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch/GoogleSearch.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator.JONNY/My Documents/Visual Studio Projects/ScreenMate/ScreenMate/bin/Debug/GoogleSearch/GoogleSearch.EXE.
LOG: All probing URLs attempted and failed.Well, it seems to state that the dll was never loaded. However, the dll must have been loaded because the form the button is on is in that dll, code is actually being run from it. It is definately something to do with the async callback. Should I try starting the Activator.CreateInstance() in another thread? Threading isn't my strong point.
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- AI don't think your problem has to do with threading. It doesn't matter on which thread you are trying to create the object, the CLR cannot find the assembly file that the object is defined in. Which files do you have as part of your application? Presumably you have an application exe and the GoogleSearch.dll is the plugin. Is the GoogleSearch dll located at any of the locations in the output above? If so is the dll of the same version listed above (i.e. 1.0.1212.29205)? Regards Mark Smithson
-
I don't think your problem has to do with threading. It doesn't matter on which thread you are trying to create the object, the CLR cannot find the assembly file that the object is defined in. Which files do you have as part of your application? Presumably you have an application exe and the GoogleSearch.dll is the plugin. Is the GoogleSearch dll located at any of the locations in the output above? If so is the dll of the same version listed above (i.e. 1.0.1212.29205)? Regards Mark Smithson
googlesearch.dll is located in the /plugin directory. But I don't see how this causes a problem since the plugin is already loaded and working, so the file location shouldn't matter, but obviously if its looking in the wrong place for it then there must be a problem. On the point of asyncs. Would it help if I made the async methods static, might this help resolve stuff?
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- Anon
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^]
-
googlesearch.dll is located in the /plugin directory. But I don't see how this causes a problem since the plugin is already loaded and working, so the file location shouldn't matter, but obviously if its looking in the wrong place for it then there must be a problem. On the point of asyncs. Would it help if I made the async methods static, might this help resolve stuff?
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- Anon
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^]
I'm not really sure what you mean by 'loaded and working'. You code and the errors imply that the CLR cannot load a type. This is because your plugin directory is not in the probing path for the application. Your will either need to change your applications config file to include this directory, or manually load the assemblies. Try adding the following to your app.config file
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="plugins"/>
</assemblyBinding>
</runtime>
</configuration>Also have a look at the following MSDN link for further information on the how the CLR locates assemblies http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhowruntimelocatesassemblies.asp Regards Mark Smithson
-
I'm not really sure what you mean by 'loaded and working'. You code and the errors imply that the CLR cannot load a type. This is because your plugin directory is not in the probing path for the application. Your will either need to change your applications config file to include this directory, or manually load the assemblies. Try adding the following to your app.config file
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="plugins"/>
</assemblyBinding>
</runtime>
</configuration>Also have a look at the following MSDN link for further information on the how the CLR locates assemblies http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhowruntimelocatesassemblies.asp Regards Mark Smithson
Cheers that seems to have done the trick! I knew it would be simple :-)
"If you just say porn then you get all manner of chaff and low grade stuff."
- Paul Watson, Lounge 25 Mar 03
"If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?"
- Anon
Jonathan 'nonny' Newman Homepage [www.nonny.com] [^]