Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Executin Plugins

Executin Plugins

Scheduled Pinned Locked Moved C#
csharpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CWIZO
    wrote on last edited by
    #1

    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!

    H 1 Reply Last reply
    0
    • C CWIZO

      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!

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Try debugging your application. Put a breakpoint on the Plugin.ExecutePlugin statement, as well as on the first statement in the implementation of ICowPlugin.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-----

      C 1 Reply Last reply
      0
      • H Heath Stewart

        Try debugging your application. Put a breakpoint on the Plugin.ExecutePlugin statement, as well as on the first statement in the implementation of ICowPlugin.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-----

        C Offline
        C Offline
        CWIZO
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups