为什么为未使用的变量赋值会对此异步代码的function产生影响?

我有这个代码:

private async Task SavePlatypusComplianceFileOnServer(string year, string month) { string monthAsMM = ReportRunnerConstsAndUtils.GetMonthAsMM(month); HttpClient client = new HttpClient(); client.BaseAddress = new Uri(ReportRunnerConstsAndUtils.SERVER_BASE_ADDRESS); String uriToCall = String.Format("/api/PlatypusCompliance/{0}/{1}{2}", _unit, year, monthAsMM); HttpResponseMessage response = await client.PostAsync(uriToCall, null); } 

……工作正常

不过,看着它,我心里想,“自我,为什么你在不使用它时为”响应“赋值?为什么不在没有它的情况下调用方法?毕竟,Visual Studio或Resharper灰色用“回应”表示你没有实际意义/冗余。“

所以我将代码更改为:

 private async Task SavePlatypusComplianceFileOnServer(string year, string month) { . . . // all but the last line of the code is exactly the same await client.PostAsync(uriToCall, null); } 

但是随着这种变化,所有达拉斯都会崩溃 – 我得到的错误消息是关于表不能被删除因为它们不存在,并且通过PostAsync()调用该方法不成功。

为什么在不使用时为响应分配值是否会产生差异?