某些 C# 代码导致 "Server Busy" 错误消息

Some C# code cause to "Server Busy" error message

以下代码:

(调用 return 任务的异步方法)

...
        Task<int> taskInt = Globals.ThisAddIn._DAL.InsertTestAceQL();
        int resInt = taskInt.Result;
        MessageBox.Show("resInt= " + resInt.ToString());
...
        public async Task<int> InsertTestAceQL()
        {
            int res = int.MinValue;
            try
            {
                string sql = "INSERT INTO dbo.AceQLTst2 VALUES ('From Visio')";

                AceQLCommand command = new AceQLCommand(sql, AceQLConn().Result);
                try
                {
                    res = await command.ExecuteNonQueryAsync();
                }
                catch (AceQLException ex)
                {
                    Globals.ThisAddIn.HandleException(ex.Message);
                }
            }
            catch (Exception ex)
            {
                Globals.ThisAddIn.HandleException(ex.Message);
            }

            return res;
        }
...

导致以下错误消息:

而且代码卡住了。

有人知道吗?

没有任何 C# 代码导致任何服务器繁忙。

发生的事情是 UI 被以下代码阻止:

int resInt = taskInt.Result;

和 Windows 告诉您应用程序正忙且没有响应 - 已被阻止 UI。