title: .NET 5 vNext Resolving dependencies with parameters
body: <p>I have been able to resolve dependencies with parameterless constructors using <strong>vNext DI</strong>.</p>
  
  <p>But when I tried to specify a parameter for one of my dependencies, it gives runtime error: </p>
  
  <blockquote>
    <p>System.InvalidOperationException Unable to resolve service for type
    'System.String' while attempting to activate 'Namespace.MyService'</p>
  </blockquote>
  
  <p><strong>Constructor:</strong></p>
  
  <pre><code>public MyService(string name)
  {
      // initialize
  }
  </code></pre>
  
  <p><strong>Usage:</strong></p>
  
  <pre><code>private readonly IMyService _myService;
  public Consumer(IMyService myService)
  {
          // initialize
          _myService = myService;
  }
  </code></pre>
  
  <p>I updated this dependency registration by adding:</p>
  
  <pre><code>services.AddInstance(new MyService("Hello"));
  </code></pre>
  
  <p>It only works if I update the Consumer class constructor parameter to use type <strong>MyService</strong></p>
  
  <p>My initial registration was:</p>
  
  <pre><code>services.AddTransient&lt;IMyService, MyService&gt;(); // Todo: configure constructor injection
  </code></pre>
  
  <p>I really want to use the interfaces not the concrete classes for this process. How can I get this to work?</p>