title: What to troubleshoot MEF C#
body: <p>The following demo application on MEF technology does not work.
  Can't build the simplest extensible application. I started with the simplest, a console application that will simply display text on the screen according to the specified parameters. And even here he did not go to me. Where to dig?</p>
  <p>IDemoInterface.cs</p>
  <pre><code>public interface IDemoInretface
  {
      void Run(int sleep, int count);
  }
  </code></pre>
  <p>MEFDataDemo
  Program.cs</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.Composition;
  using System.ComponentModel.Composition.Hosting;
  using System.IO;
  
  namespace MEFDataDemo
  {
      class Program
      {
          static void Main(string[] args)
          {
              Program p = new Program();
              p.Run();
          }
  
          public void Run()
          {
              DoImport();
              int count = 1;
              foreach (var item in Plugin)
              {
                  item.Value.Run(count * 1000, count * 10);*** This is Error
                  count++;
              }
          }
  
          [ImportMany(typeof(IDemoInretface))]
          public IEnumerable&lt;Lazy&lt;IDemoInretface&gt;&gt; Plugin { get; set; }
  
          public void DoImport()
          {
              var catalog = new AggregateCatalog();
              var path = Path.Combine(Directory.GetCurrentDirectory(), &quot;Plugins&quot;);
              catalog.Catalogs.Add(new DirectoryCatalog(path));
              var container = new CompositionContainer(catalog);
              container.ComposeParts(this);
          }
      }
  } 
  </code></pre>
  <p>Plugin1 Class1.cs</p>
  <pre><code>    using System;
  using System.ComponentModel.Composition;
  using System.Threading;
  
  namespace Plugin1
  {
      [Export(typeof(IDemoInretface))]
      internal class Class1 : IDemoInretface
      {
          public void Run(int sleep, int count)
          {
              for (int i = 0; i &lt; count; i++)
              {
                  Console.WriteLine(&quot;This plugin1 print {0}/{1} in {2}ms&quot;, i, count, sleep);
                  Thread.Sleep(sleep);
              }
          }
      }
  }
  </code></pre>
  <p>What am I doing wrong?
  The program compiles, but either does not read plugins, or reads but does not run the (RUN) method</p>