System.ExecutionEngineException at random times when using HttpClient on windows phone

239 Views Asked by At

I got code like this. When I execute it I got ExecutionEngineException and my app got shut down. I don't know what can I do to fix it. Any ideas? According to my research it's shouldn't be caused by my code. It didn't caused this error before. I just changed views using blend (imported them from photoshop and created controls to be more precious)

public async Task<string> postAsync(string adress,string json) 
    {
        HttpClient httpClient = new HttpClient();
        httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        httpClient.DefaultRequestHeaders.ConnectionClose = true;
        var response = await httpClient.PostAsync(basicUrl + adress, new StringContent(json, Encoding.UTF8, "application/json"));
        //response.EnsureSuccessStatusCode();
        var responseJson = await response.Content.ReadAsStringAsync();
        return responseJson;
    }
0

There are 0 best solutions below