gpt4 book ai didi

silverlight - 找不到 async 修饰符所需的所有类型

转载 作者:行者123 更新时间:2023-12-04 17:11:10 26 4
gpt4 key购买 nike

我收到以下两个编译器错误(Resharper 7.0.1 没有报告错误):

Predefined type 'System.Runtime.CompilerServices.IAsyncStateMachine' is not defined or imported



Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?



但这段代码不会编译:
public class Class1
{
public Class1()
{
Um();
}
public async Task<DownloadStringCompletedEventArgs> Um()
{
var client = new WebClient();
return await Observable.FromEvent<DownloadStringCompletedEventHandler, DownloadStringCompletedEventArgs>(x => client.DownloadStringCompleted += x,
x => client.DownloadStringCompleted -= x);
}
}

我见过 MSBuild doesn't find async required references已经除了我有 VS 2012 NOT VS 11 Beta - 尽管它已安装。我也在一个全新的程序集中尝试了它,没有指向应用程序的 xaml 命名空间。

最佳答案

您需要 Async Targeting Pack支持async在 Silverlight 5 中。

关于silverlight - 找不到 async 修饰符所需的所有类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12987161/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com