title: Why can't these generic type parameters be inferred?
body: <p>Given the following interfaces/classes:</p>
  
  <pre><code>public interface IRequest&lt;TResponse&gt; { }
  
  public interface IHandler&lt;TRequest, TResponse&gt;
      where TRequest : IRequest&lt;TResponse&gt;
  {
      TResponse Handle(TRequest request);
  }
  
  public class HandlingService
  {
      public TResponse Handle&lt;TRequest, TResponse&gt;(TRequest request)
          where TRequest : IRequest&lt;TResponse&gt;
      {
          var handler = container.GetInstance&lt;IHandler&lt;TRequest, TResponse&gt;&gt;();
          return handler.Handle(request);
      }
  }
  
  public class CustomerResponse
  {
      public Customer Customer { get; set; }
  }
  
  public class GetCustomerByIdRequest : IRequest&lt;CustomerResponse&gt;
  {
      public int CustomerId { get; set; }
  }
  </code></pre>
  
  <p>Why can't the compiler infer the correct types, if I try and write something like the following:</p>
  
  <pre><code>var service = new HandlingService();
  var request = new GetCustomerByIdRequest { CustomerId = 1234 };
  var response = service.Handle(request);  // Shouldn't this know that response is going to be CustomerResponse?
  </code></pre>
  
  <p>I just get the 'type arguments cannot be inferred' message.  Is this a limitation with generic type inference in general, or is there a way to make this work?</p>