Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC#ConfigureAwait falseSingle-choice MCQ

A WinForms event handler runs the code below and the UI freezes (deadlocks). How does adding ConfigureAwait(false) to the awaited call inside GetDataAsync change the outcome?

void Button_Click(object s, EventArgs e) { var data = GetDataAsync().Result; // blocks UI thread label.Text = data; } async Task<string> GetDataAsync() { await Task.Delay(1000); // continuation wants the UI thread return "done"; }