Executin Plugins
-
Hi all, I have this code that loads-up some plugins(dll files), and I'm having trouble executing them. Every plugin has a ExecutePlugin(string Commands) method defined. So when I wan't to execute all of my plugins from my main program I have this code: foreach ( Type DllType in Plugins ) { ICowPlugin Plugin = (ICowPlugin) Activator.CreateInstance ( DllType ); Plugin.ExecutePlugin ( "Plugins rox" ); MessageBox.Show ( Plugin.PluginName ); } and strange is that the MessageBox.Show(Plugin.PluginName); indeed shows the name of the plugin, but code inside of ExecutePlugin() is aparently not executed. I have a simple MessageBox.Show() inside the plugin's ExecutePlugin and the message box is not shown Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
-
Hi all, I have this code that loads-up some plugins(dll files), and I'm having trouble executing them. Every plugin has a ExecutePlugin(string Commands) method defined. So when I wan't to execute all of my plugins from my main program I have this code: foreach ( Type DllType in Plugins ) { ICowPlugin Plugin = (ICowPlugin) Activator.CreateInstance ( DllType ); Plugin.ExecutePlugin ( "Plugins rox" ); MessageBox.Show ( Plugin.PluginName ); } and strange is that the MessageBox.Show(Plugin.PluginName); indeed shows the name of the plugin, but code inside of ExecutePlugin() is aparently not executed. I have a simple MessageBox.Show() inside the plugin's ExecutePlugin and the message box is not shown Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!
Try debugging your application. Put a breakpoint on the
Plugin.ExecutePlugin
statement, as well as on the first statement in the implementation ofICowPlugin.ExecutePlugin
. As long as all your assemblies are compiled with the DEBUG preproc def (i.e., a Debug build) and loaded into your solution, you should have no problem determining if the method is actually executed (and it should be if no exception is being thrown, which doesn't seem to be the case since the next statement is executed) and if something is going wrong inside the method. An exception might be thrown in the implementation that you're also catching and returning from, so maybe you're not getting the results you want. Debugging this method will help determine the cause of the problem.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Try debugging your application. Put a breakpoint on the
Plugin.ExecutePlugin
statement, as well as on the first statement in the implementation ofICowPlugin.ExecutePlugin
. As long as all your assemblies are compiled with the DEBUG preproc def (i.e., a Debug build) and loaded into your solution, you should have no problem determining if the method is actually executed (and it should be if no exception is being thrown, which doesn't seem to be the case since the next statement is executed) and if something is going wrong inside the method. An exception might be thrown in the implementation that you're also catching and returning from, so maybe you're not getting the results you want. Debugging this method will help determine the cause of the problem.-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
Hi, Im relativlly new to C#, so I dont really know what to look for. THe method aparently works just fine and is "error-less" becouse when I compiled the plugin the compiller didn't return me any warnings or errors. THe ExecutePlugin inside the plugin looksliek this: public void ExecutePlugin ( string Commands ) { MessageBox.Show ( Commands, PluginName ); } and liek I said I cen get the PluginName property inside my main programm, but the messagebox dosen't show ... Q:What does the derived class in C# tell to it's parent? A:All your base are belong to us!