After installing VS 2019 preview 2 i get a great number of errors. Error demo code:
public class Class1 {
public static async IAsyncEnumerable<int> Get()
{
for( int i = 0; i < 10; i++ ) {
await Task.Delay( 100 );
yield return i;
}
}
}
and nothig more (a new dll project)!
With preview 1 was ok.
The project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
</Project>
The error message is: Error CS0656 Missing compiler required member 'System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator'
Object Browser shows the member in Collections.Generic.
Any ideas? Waiting for Core 3.0 preview 2?
Something like in IAsyncEnumerable not working in C# 8.0 preview ?
Another problem with VS 2019 P2 (another project): Nullabilty warnings though NullableReferenceTypes line is there (in vs 19, preview 1 was ok):
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>8.0</LangVersion>
**<NullableReferenceTypes>true</NullableReferenceTypes>**
The warning:
Warning CS8632 The annotation for nullable reference types should only be used in code within a '#nullable' context.
Is project setting not enough? not global any more?
NET 6, though, is ASP.NET Core 6, a major upgrade of Microsoft's open source framework for building modern web applications. ASP.NET Core 6 is built on top of the . NET Core runtime and allows you to build and run applications on Windows, Linux, and macOS. ASP.NET Core 6 combines the features of Web API and MVC.
NET unification is the support for Windows desktop applications. With this addition, . NET Core 3.0 allows you to run new and existing Windows desktop applications using the UI framework of your choice. In fact, the new release brings Windows Forms (WinForms) and Windows Presentation Foundation (WPF) to . NET Core.
Better performance: . NET 6 is the fastest full stack web framework, which lowers compute costs if you're running in the cloud. Ultimate productivity: . NET 6 and Visual Studio 2022 provide hot reload, new git tooling, intelligent code editing, robust diagnostics and testing tools, and better team collaboration.
Missing compiler required member 'System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator'
Install .NET Core v3.0.100-preview-010177
https://github.com/dotnet/core-sdk#installers-and-binaries
There was a breaking change to IAsyncEnumerable
from .NET Core 3 Preview 1 to .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.
Source: https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-with-patterns-in-c-8-0/
The annotation for nullable reference types should only be used in code within a '#nullable' context
Change<NullableReferenceTypes>true</NullableReferenceTypes>
to
<NullableContextOptions>enable</NullableContextOptions>
This is a breaking change from VS2019 Preview 1 to VS2019 Preview 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.
Source: https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-with-patterns-in-c-8-0/
Replacing
<NullableReferenceTypes>true</NullableReferenceTypes>
With
<NullableContextOptions>enable</NullableContextOptions>
Fixed my issues with nullable reference types.
EDIT:
It may be worth having both options in the .csproj file as the dotnet Docker images has not yet been updated and will fail as it does not recognize the new nullable reference type tag
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With