System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Html.HtmlString]

Joined
Aug 14, 2021
Messages
18
Programming Experience
Beginner
Hello.I wanted to ask how does this line below the results have come up since I've done the same as the tutorial has done.Everything is good only I get this line at the end System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Html.HtmlString].But I haven't written it anywhere.Any help would be appreciated.
 

Attachments

  • Screenshot 2021-09-28 203840.png
    Screenshot 2021-09-28 203840.png
    59.8 KB · Views: 125
Without seeing the Razor used to render that page all we can guess is that you are calling an asynchronous method that returns a Task<HtmlString>. You forgot to await the results of that Task, and instead you just had the Razor page render the Task<HtmlString>.
 
Without seeing the Razor used to render that page all we can guess is that you are calling an asynchronous method that returns a Task<HtmlString>. You forgot to await the results of that Task, and instead you just had the Razor page render the Task<HtmlString>.
And where should I see the Razor?Because I have no idea where it could be written?
 

Attachments

  • Screenshot 2021-09-28 220051.png
    Screenshot 2021-09-28 220051.png
    34.9 KB · Views: 45
I guess it's the blind leading the blind.

You could start off by at least telling us which tutorial you are following and what version of the various components you are using.

You can also tell us what page of that tutorial you are viewing, or if you are getting that page as the result of navigating to a particular location. I mention this because the screenshot shows "Back to the list" which would suggest that this is a details view of an item from a list, which would suggest that you initially viewed a list and then navigated to this page.
 
I guess it's the blind leading the blind.

You could start off by at least telling us which tutorial you are following and what version of the various components you are using.

You can also tell us what page of that tutorial you are viewing, or if you are getting that page as the result of navigating to a particular location. I mention this because the screenshot shows "Back to the list" which would suggest that this is a details view of an item from a list, which would suggest that you initially viewed a list and then navigated to this page.
Wish I could send you the whole file.It's from

Mastering ASP.NET Core MVC 3.1 & 5.0 From Scratch Using C# in UDEMY Section 20: Developing ViewComponents lecture 92. Creating a Hybrid Controller Class.It's okay if you can't help,it's probably too hard to know from such little information and since I didn't understand at all what you replied besides telling from where the tutorial is.​

 
Looks like we've gotta pay to get access to that tutorial.

You could do what most web developers end up doing: Open up DevTools and narrow things down by right clicking and inspecting items on the page. Then try to narrow down what bit of Razor is generating the surrounding parts. What's in the middle is the part that is generating the offending text.
 
Back
Top Bottom