Closed zhiyuanliang-ms closed 2 months ago
Is it possible we can add test to make sure we are netstandard/netfx 4.x compatible?
Is it possible we can add test to make sure we are netstandard/netfx 4.x compatible?
Currently, the TargetFrameworks
is netstand2.0 but the LangVersion
is 9.0, maybe we should set the LangVersion
to 7.3 or remove the LangVersion
.
https://github.com/microsoft/FeatureManagement-Dotnet/blob/main/src/Microsoft.FeatureManagement/Microsoft.FeatureManagement.csproj
I checked other .net libraries which targets on netstandard, I found they didn't specify the LangVersion
https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Bcl.TimeProvider/src/Microsoft.Bcl.TimeProvider.csproj
Maybe, we should do the same thing.
@jimmyca15 @zhenlan
Maybe we should set the LangVersion
to 8.0. The things get quite tricky here.
We have an API: IAsyncEnumerable<string> GetFeatureNamesAsync()
of IFeatureManager
,
However, async stream is not available in C# 7.3 (need 8.0+), so the GetFeatureNamesAsync
will not work for .NET framework app.
The await foreach()
syntax is exclusive to 8.0 and up, but you can still use the type manually in 7.3, getting an enumerator and calling next asynchronously in a while loop.
https://learn.microsoft.com/en-us/archive/msdn-magazine/2019/november/csharp-iterating-with-async-enumerables-in-csharp-8#a-tour-through-async-enumerables
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.iasyncenumerable-1.getasyncenumerator?view=netframework-4.8#system-collections-generic-iasyncenumerable-1-getasyncenumerator(system-threading-cancellationtoken)
Using language version 8.0.0 would ensure we couldn't write init only setters. It also prevents us from taking advantage of new language features but that may be what makes sense since we are supporting netstandard.
/AzurePipeline run
/AzurePipeline run
Why this PR?
435
Visible change
Replace
init
setter toset