Could someone explain to me why this code does not block UI ? Im not creating any new thread/task and application just works fine.
private void button1_Click(object sender, EventArgs e)
{
Test1();
}
private async void Test1()
{
var random = new Random();
while (true)
{
try
{
textBox1.Text = random.Next(1, 100).ToString();
textBox2.Text = random.Next(1, 100).ToString();
await Task.Delay(5000);
}
catch (Exception)
{
break;
throw;
}
}
}