'IHtmlHelper dynamic' has no applicable method named 'PartialAsync'

Question: How do you resolve "Severity Code Description Project File Line Suppression State
Error CS1973 'IHtmlHelper<dynamic>' has no applicable method named 'PartialAsync' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax. File Path.".

Please Login to see the rest of the answer

Answer: There is a chance you are calling a Partial using an Async Function, Partials in Asp.Net 6 are already optimized for performance there is no need to call an awaiter, the underlying Partial API will call this a corresponding Partial file accordingly.

In order to resolve this error just use the code below:
<partial name="Path/_FileName" />

Do not use the code below:
@await Html.PartialAsync("Path/_FileName", data).ConfigureAwait(false)

Write an Article
#MVC #AspNet 6 #e-book #MVC #Razor .NET 6 published
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

© 2022 - ErnesTech - Privacy