System.Net.Http.HttpClient.PostAsync blocks and never returns
问题 I have a .NET framework Windows Forms application with a form that has this code: using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace test { public partial class Main : Form { public int exitCode = 1; private Options opts; CancellationTokenSource cancellationSource = new CancellationTokenSource(); public Main(Options opts) { InitializeComponent(); this.opts = opts; }