title: ViewComponent InvokeAsync method and non async operation
body: <p>In asp.net core <code>ViewComponent</code> we have to implement logic in an <code>InvokeAsync</code> method that returns an <code>IViewComponentResult</code>. However I do not have any <code>async</code> logic to perform inside the invoke method. So based on <a href="https://stackoverflow.com/questions/40007669/viewcomponent-and-invokeasync-method">SO post here</a> I have removed the <code>async</code> qualifier and just return <code>Task.FromResult</code></p>
  
  <pre><code>public Task&lt;IViewComponentResult&gt; InvokeAsync(MyBaseModel model)
  {        
      var name = MyFactory.GetViewComponent(model.DocumentTypeID);        
      return Task.FromResult&lt;IViewComponentResult&gt;(View(name, model));
  }
  </code></pre>
  
  <p>and then in View ( since I don't have <code>async</code> I am not using <code>await</code> here)</p>
  
  <pre><code>@Component.InvokeAsync("MyViewComponent", new { model = Model })
  </code></pre>
  
  <p>However view renders this:</p>
  
  <p><code>System.Threading.Tasks.Task</code>1[Microsoft.AspNetCore.Html.IHtmlContent]`</p>