The following Code does not change the Text and stops executing the Task
private void button1_Click(object sender, EventArgs e)
{
label1.Text = \
Task.Run
is used to envelope an Action (that is not async) into a Task. Any Task that you want to execute should be awaited. Thus, that Task.Run
of yours is rigorously doing nothing.
Mark that button1_Click
event handler of yours as async. Then remove that Task.Run
and instead do await MyAsyncMethod()
.