Why is System.Threading.Tasks.Task`1 [System.Threading.Tasks.VoidTaskResult]; appearing in my ASP.NET Core Razor Views?

Posted on Sunday, January 8, 2017 at 11:48 AM into csharp, code & gotcha by Steve Woods.
Roughly a 1 minute read.

Pretty simple really - you're not calling the correct method to render your partial views.

Instead of:

@Html.RenderPartialAsync("MyPartial", Model);

You need to use:

@await Html.PartialAsync("MyPartial", Model);

Simples :)

;

RSS 2.0 Feed | Copyright © 1999 - 2018 Steve Woods, All Rights Reserved - Warning, may contain nuts.