I am fetching data from API and trying to convert it into deserialized form. But gettting this error.
public static async Task<List<Movie>> GetAllMovies(int pageNumber, int pageSize)
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", Preferences.Get("accessToken", string.Empty));
var response = httpClient.GetStringAsync(AppSettings.ApiUrl + String.Format("api/movies/AllMovies?sort=asc&pageNumber={0}&pageSize={1}",pageNumber,pageSize));
return JsonConvert.DeserializeObject<List<Movie>>(response);
}
Use await before response
return JsonConvert.DeserializeObject<List<Movie>>(await response)