Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<pre lang="c#">

HttpClient httpClient;

forecasts = await httpClient.GetJsonAsync<T>(uri);


error: HttpClient.GetJsonAsync() method is not found

I don't know why VS 2019 giving this error.

What I have tried:

I've updated System.Net.Http library through nuget package.
Posted
Updated 22-Aug-20 4:36am
Comments
Richard Deeming 14-Oct-19 14:37pm    
Is this client-side Blazor, or server-side Blazor?

Have you added a package reference to Microsoft.AspNetCore.Blazor.HttpClient, as described in the docs[^]?
Asif Rehman 16-Oct-19 2:16am    
It is server-side blazor.


I've searched from nuget packages. I've not found that package.
Richard Deeming 16-Oct-19 13:47pm    
You'll need to tick the "Include pre-release" option in the NuGet package manager, because the package hasn't been fully released yet:
NuGet Gallery | Microsoft.AspNetCore.Blazor.HttpClient 3.1.0-preview1.19508.20[^]

It's required to add
using Microsoft.AspNetCore.Components
namespace in order for this extension method to appear.
 
Share this answer
 
It is server-side blazor.


I've searched from nuget packages. I've not found that package.
 
Share this answer
 
Comments
Richard MacCutchan 15-Oct-19 12:09pm    
This is not a Solution. Please use the Reply button to reply to someone else's comments or questions.
I have installed the package by adding the latest package ref.

<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.1.0-preview4.19579.2" />


But still i am unable to find the desired function like .. HttpClient.GetJsonAsync
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900