I have the following code and I cannot for the life of my answer why it is firing twice....
ErrorMessage pushes out a MessageBox.Show("Error")....I created the method simply to see if I could bypass this error.
Using break points I go to teh If statement, it fires, there is an error, it moves through and down to error message...it goes back to the top of the IF statement.
This happens if I have the method or simply "MessageBox.Show("Error")....
I do not understand why it is going back to the IF statement and testing twice?
C#:
HttpClient httpClient = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage();
request.RequestUri = new Uri(shortUrl);
request.Method = HttpMethod.Get;
request.Headers.Add("Key", api);
HttpResponseMessage response = await httpClient.SendAsync(request);
If (!response.IsSuccessStatusCode)
{
httpClient.Dispose();
aTimer.Stop();
ErrorMessage();
}
ErrorMessage pushes out a MessageBox.Show("Error")....I created the method simply to see if I could bypass this error.
Using break points I go to teh If statement, it fires, there is an error, it moves through and down to error message...it goes back to the top of the IF statement.
This happens if I have the method or simply "MessageBox.Show("Error")....
I do not understand why it is going back to the IF statement and testing twice?