I have the following code:
    public MainWindow()
    {
        InitializeComponent();
        RunAsync().Wait();
    }
    private static async Task RunAsync()
    {
        var baseAddress = new Uri("https://api.trakt.tv/");
        using (var httpClient = new HttpClient { BaseAddress = baseAddress })
        {
            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("trakt-api-version", "2");
            httpClient.DefaultRequestHeaders.TryAddWithoutValidation("trakt-api-key", "");
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            using (var response = await httpClient.GetAsync("search?query=Arrow&type=Show"))
            {
                string responseData = await response.Content.ReadAsStringAsync();
            }
        }
    }
When I run it, it get stuck at the part:
using (var response = await httpClient.GetAsync("search?query=Arrow&type=Show"))
This never finishes running. But if I take off the .Wait() from     RunAsync().Wait(); then the code run to the end normally. Why is it getting stuck when I put .Wait() on the method call?
I have to put it, because if i don't the rest of the code will continue to run and wont wait the method to complete...
 
     
    