sách gpt4 ăn đã đi

c# - IAsyncEnumerable<> 在 VS 2019 预览版 2(Core 3.0 预览版 1)中损坏

In lại 作者:太空狗 更新时间:2023-10-29 22:21:16 26 4
mua khóa gpt4 giày nike

安装 VS 2019 预览版 2 后出现大量错误。错误演示代码:

public class Class1 {
public static async IAsyncEnumerable Get()
{
for( int i = 0; i < 10; i++ ) {
await Task.Delay( 100 );
yield return i;
}
}
}

仅此而已(一个新的 dll 项目)!
预览 1 没问题。

项目:



netcoreapp3.0
8.0


错误信息是:错误 CS0656 缺少编译器所需的成员 'System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator'

对象浏览器显示 Collections.Generic 中的成员。

有什么想法吗?等待 Core 3.0 预览版 2?

类似于 IAsyncEnumerable not working in C# 8.0 preview 中的内容?

VS 2019 P2 的另一个问题(另一个项目):尽管存在 NullableReferenceTypes 行,但出现可空性警告(在 vs 19 中,预览 1 没问题):



netcoreapp3.0
8.0
**true**

cảnh báo:
警告 CS8632 可为 null 的引用类型的注释只能在“#nullable”上下文中的代码中使用。
项目设置不够?不再是全局性的了吗?

câu trả lời hay nhất

问题1

缺少编译器所需的成员 'System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator'

giải pháp

安装 .NET Core v3.0.100-preview-010177

https://github.com/dotnet/core-sdk#installers-and-binaries

giải thích

IAsyncEnumerable 进行了重大更改从 .NET Core 3 Preview 1 到 .NET Core Preview 2

Async streams

We changed the shape of the IAsyncEnumerable interface the compiler expects! This brings the compiler out of sync with the interface provided in .NET Core 3.0 Preview 1, which can cause you some amount of trouble. However, .NET Core 3.0 Preview 2 is due out shortly, and that brings the interfaces back in sync.

nguồn:https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-with-patterns-in-c-8-0/

问题2

可空引用类型的注解应该只在“#nullable”上下文中的代码中使用

giải pháp

更改 true

đến

enable

giải thích

这是从 VS2019 预览版 1 到 VS2019 预览版 2 的重大更改。

Nullable reference types

We’ve added more options to control nullable warnings both in source (through #nullable and #pragma warning directives) and at the project level. We also changed the project file opt-in to enable.

nguồn:https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-with-patterns-in-c-8-0/

关于c# - IAsyncEnumerable<> 在 VS 2019 预览版 2(Core 3.0 预览版 1)中损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54364439/

26 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress