在 c# UWP 应用程序中,当代码命中 await 关键字时,错误消息'value does not fall in the expected range'

问题描述 投票:0回答:0

我正在使用 Template Studio for WinUI targeting .NET 7。当代码在异步任务 <> 程序定义中遇到 await 关键字时,它会在

await SqlConnection.OpenAsync();
await cmd.ExecuteReaderAsync();

上抛出“值不在预期范围内”错误

当我在控制台应用程序 (.NET 7.0) 中使用 Async 时,它有效。

有人对如何解决这个问题有什么建议吗?

c# uwp uwp-xaml
© www.soinside.com 2019 - 2024. All rights reserved.