Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit bfcbf22

Browse files
joperezrstephentoub
authored andcommitted
Adding Microsoft.Bcl.AsyncInterfaces for .NET Standard 2.0 (#37189)
* Adding Microsoft.Compatibility.AsyncInterfaces package * Addressing PR Feedback * Fix small typo * Remove unnecesary configurations from the package * Rename to Microsoft.Bcl.AsyncInterfaces * Addressing PR Feedback
1 parent dda3289 commit bfcbf22

12 files changed

+221
-7
lines changed

eng/configurations/targetgroups.props

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@
4242
<PackageTargetRuntimeSuffix>aot</PackageTargetRuntimeSuffix>
4343
<UWPCompatible>true</UWPCompatible>
4444
<Imports>uap10.0.16299aot</Imports>
45-
<CompatibleWith>uapvnext;netstandard2.0</CompatibleWith>
45+
<CompatibleWith>uapvnext;netstandard2.1</CompatibleWith>
4646
</TargetGroups>
4747
<TargetGroups Include="uapvnext">
4848
<TargetFramework>$(UAPvNextTFM)</TargetFramework>
4949
<TargetFrameworkIdentifier>$(UAPvNextTFI)</TargetFrameworkIdentifier>
5050
<TargetFrameworkVersion>$(UAPvNextVersion)</TargetFrameworkVersion>
5151
<UWPCompatible>true</UWPCompatible>
5252
<Imports>uap10.0.16299</Imports>
53-
<CompatibleWith>netstandard2.0</CompatibleWith>
53+
<CompatibleWith>netstandard2.1</CompatibleWith>
5454
</TargetGroups>
5555
<!-- uap is an alias for uapvNext any/coreclr runtime -->
5656
<TargetGroups Include="uap">
@@ -59,7 +59,7 @@
5959
<TargetFrameworkVersion>$(UAPvNextVersion)</TargetFrameworkVersion>
6060
<UWPCompatible>true</UWPCompatible>
6161
<Imports>uapvnext</Imports>
62-
<CompatibleWith>netstandard</CompatibleWith>
62+
<CompatibleWith>netstandard2.1</CompatibleWith>
6363
</TargetGroups>
6464
<!-- uapaot is an alias for uapvNext, aot runtime -->
6565
<TargetGroups Include="uapaot">
@@ -69,7 +69,7 @@
6969
<PackageTargetRuntimeSuffix>aot</PackageTargetRuntimeSuffix>
7070
<UWPCompatible>true</UWPCompatible>
7171
<Imports>uapvnextaot</Imports>
72-
<CompatibleWith>uap;netstandard</CompatibleWith>
72+
<CompatibleWith>uap;netstandard2.1</CompatibleWith>
7373
</TargetGroups>
7474
<TargetGroups Include="netstandard1.0">
7575
<TargetFramework>netstandard1.0</TargetFramework>
@@ -126,6 +126,13 @@
126126
<UWPCompatible>true</UWPCompatible>
127127
<Imports>netstandard1.6</Imports>
128128
</TargetGroups>
129+
<TargetGroups Include="netstandard2.1">
130+
<TargetFramework>netstandard2.1</TargetFramework>
131+
<!-- By default, netstandard libraries will be held to the UWP compatibility bar;
132+
set this to false in the project to force otherwise. -->
133+
<UWPCompatible>true</UWPCompatible>
134+
<Imports>netstandard</Imports>
135+
</TargetGroups>
129136
<!-- netstandard is an alias for netstandard2.0 -->
130137
<TargetGroups Include="netstandard">
131138
<TargetFramework>netstandard2.0</TargetFramework>
@@ -157,14 +164,14 @@
157164
<NETCoreAppMaximumVersion>3.0</NETCoreAppMaximumVersion>
158165
<TargetFramework>netcoreapp3.0</TargetFramework>
159166
<Imports>netcoreapp2.2</Imports>
160-
<CompatibleWith>netstandard</CompatibleWith>
167+
<CompatibleWith>netstandard2.1</CompatibleWith>
161168
</TargetGroups>
162169
<!-- netcoreapp is an alias for netcoreapp3.0 -->
163170
<TargetGroups Include="netcoreapp">
164171
<NETCoreAppMaximumVersion>3.0</NETCoreAppMaximumVersion>
165172
<TargetFramework>netcoreapp3.0</TargetFramework>
166173
<Imports>netcoreapp3.0</Imports>
167-
<CompatibleWith>netstandard</CompatibleWith>
174+
<CompatibleWith>netstandard2.1</CompatibleWith>
168175
</TargetGroups>
169176
<TargetGroups Include="net45">
170177
<TargetFramework>net45</TargetFramework>

pkg/Microsoft.Private.PackageBaseline/packageIndex.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"net45": "4.0.0.0"
2828
}
2929
},
30+
"Microsoft.Bcl.AsyncInterfaces": {
31+
"InboxOn": {},
32+
"AssemblyVersionInPackageVersion": {
33+
"1.0.0.0": "1.0.0"
34+
}
35+
},
3036
"Microsoft.Bcl.Json.Sources": {
3137
"InboxOn": {}
3238
},
@@ -427,6 +433,7 @@
427433
"netcoreapp3.0": "2.1.0.0",
428434
"net461": "2.0.0.0",
429435
"netstandard2.0": "2.0.0.0",
436+
"netstandard2.1": "2.1.0.0",
430437
"uap10.0.16299": "2.0.0.0",
431438
"uap10.0.16300": "2.1.0.0"
432439
}
@@ -5944,4 +5951,4 @@
59445951
"System.Xml.XDocument"
59455952
]
59465953
}
5947-
}
5954+
}

pkg/descriptions.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,15 @@
10421042
"System.Buffers.Text.Utf8Formatter"
10431043
]
10441044
},
1045+
{
1046+
"Name": "Microsoft.Bcl.AsyncInterfaces",
1047+
"Description": "Provides the IAsyncEnumerable<T> and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.",
1048+
"CommonTypes": [
1049+
"System.IAsyncDisposable",
1050+
"System.Collections.Generic.IAsyncEnumerable",
1051+
"System.Collections.Generic.IAsyncEnumerator"
1052+
]
1053+
},
10451054
{
10461055
"Name": "System.Net.Http",
10471056
"Description": "Provides a programming interface for modern HTTP applications, including HTTP client components that allow applications to consume web services over HTTP and HTTP components that can be used by both clients and servers for parsing HTTP headers.",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<Import Project="..\Directory.Build.props" />
3+
<PropertyGroup>
4+
<AssemblyVersion>1.0.0.0</AssemblyVersion>
5+
<PackageVersion>1.0.0</PackageVersion>
6+
<StrongNameKeyId>Open</StrongNameKeyId>
7+
<!-- This assembly should never be placed inbox as it is only for downlevel compatibility. -->
8+
</PropertyGroup>
9+
</Project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.27213.1
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bcl.AsyncInterfaces", "src\Microsoft.Bcl.AsyncInterfaces.csproj", "{96A7CE75-B5E8-421B-BDF0-C4651D97D8CA}"
6+
ProjectSection(ProjectDependencies) = postProject
7+
{6371299B-8F39-4A0A-A9CD-70F80FF205F6} = {6371299B-8F39-4A0A-A9CD-70F80FF205F6}
8+
EndProjectSection
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bcl.AsyncInterfaces", "ref\Microsoft.Bcl.AsyncInterfaces.csproj", "{6371299B-8F39-4A0A-A9CD-70F80FF205F6}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
13+
EndProject
14+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
15+
EndProject
16+
Global
17+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18+
Debug|Any CPU = Debug|Any CPU
19+
Release|Any CPU = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{96A7CE75-B5E8-421B-BDF0-C4651D97D8CA}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
23+
{96A7CE75-B5E8-421B-BDF0-C4651D97D8CA}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
24+
{96A7CE75-B5E8-421B-BDF0-C4651D97D8CA}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
25+
{96A7CE75-B5E8-421B-BDF0-C4651D97D8CA}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
26+
{6371299B-8F39-4A0A-A9CD-70F80FF205F6}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
27+
{6371299B-8F39-4A0A-A9CD-70F80FF205F6}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
28+
{6371299B-8F39-4A0A-A9CD-70F80FF205F6}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
29+
{6371299B-8F39-4A0A-A9CD-70F80FF205F6}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(NestedProjects) = preSolution
35+
{96A7CE75-B5E8-421B-BDF0-C4651D97D8CA} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
36+
{6371299B-8F39-4A0A-A9CD-70F80FF205F6} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
37+
EndGlobalSection
38+
GlobalSection(ExtensibilityGlobals) = postSolution
39+
SolutionGuid = {38217F72-3F9A-4B15-96C8-BFA23083AAD3}
40+
EndGlobalSection
41+
EndGlobal
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project DefaultTargets="Build">
2+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
3+
<ItemGroup>
4+
<ProjectReference Include="..\ref\Microsoft.Bcl.AsyncInterfaces.csproj">
5+
<SupportedFramework>net461;netcoreapp2.0;uap10.0.16299;$(AllXamarinFrameworks)</SupportedFramework>
6+
</ProjectReference>
7+
<ProjectReference Include="..\src\Microsoft.Bcl.AsyncInterfaces.csproj" />
8+
</ItemGroup>
9+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
10+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project DefaultTargets="Build">
2+
<PropertyGroup>
3+
<BuildConfigurations>
4+
netstandard;
5+
netstandard2.1;
6+
</BuildConfigurations>
7+
</PropertyGroup>
8+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.IAsyncDisposable))]
6+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.IAsyncEnumerable<>))]
7+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.IAsyncEnumerator<>))]
8+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.AsyncIteratorStateMachineAttribute))]
9+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.ConfiguredAsyncDisposable))]
10+
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<>))]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
// ------------------------------------------------------------------------------
5+
// Changes to this file must follow the http://aka.ms/api-review process.
6+
// ------------------------------------------------------------------------------
7+
8+
namespace System
9+
{
10+
public partial interface IAsyncDisposable
11+
{
12+
System.Threading.Tasks.ValueTask DisposeAsync();
13+
}
14+
}
15+
namespace System.Collections.Generic
16+
{
17+
public partial interface IAsyncEnumerable<out T>
18+
{
19+
System.Collections.Generic.IAsyncEnumerator<T> GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
20+
}
21+
public partial interface IAsyncEnumerator<out T> : System.IAsyncDisposable
22+
{
23+
T Current { get; }
24+
System.Threading.Tasks.ValueTask<bool> MoveNextAsync();
25+
}
26+
}
27+
namespace System.Runtime.CompilerServices
28+
{
29+
[System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)]
30+
public sealed partial class AsyncIteratorStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
31+
{
32+
public AsyncIteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
33+
}
34+
public readonly partial struct ConfiguredAsyncDisposable
35+
{
36+
private readonly object _dummy;
37+
private readonly int _dummyPrimitive;
38+
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable DisposeAsync() { throw null; }
39+
}
40+
public readonly partial struct ConfiguredCancelableAsyncEnumerable<T>
41+
{
42+
private readonly object _dummy;
43+
private readonly int _dummyPrimitive;
44+
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
45+
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T>.Enumerator GetAsyncEnumerator() { throw null; }
46+
public System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable<T> WithCancellation(System.Threading.CancellationToken cancellationToken) { throw null; }
47+
public readonly partial struct Enumerator
48+
{
49+
private readonly object _dummy;
50+
private readonly int _dummyPrimitive;
51+
public T Current { get { throw null; } }
52+
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable DisposeAsync() { throw null; }
53+
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<bool> MoveNextAsync() { throw null; }
54+
}
55+
}
56+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<ProjectGuid>{6371299B-8F39-4A0A-A9CD-70F80FF205F6}</ProjectGuid>
4+
<Configurations>netstandard-Debug;netstandard-Release;netstandard2.1-Debug;netstandard2.1-Release</Configurations>
5+
</PropertyGroup>
6+
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard'">
7+
<Compile Include="Microsoft.Bcl.AsyncInterfaces.cs" />
8+
<Reference Include="System.Threading.Tasks.Extensions" />
9+
</ItemGroup>
10+
<ItemGroup Condition="'$(TargetGroup)' != 'netstandard'">
11+
<Compile Include="Microsoft.Bcl.AsyncInterfaces.Forwards.cs" />
12+
</ItemGroup>
13+
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard'">
14+
<Reference Include="System.Runtime" />
15+
<Reference Include="System.Threading.Tasks" />
16+
</ItemGroup>
17+
</Project>

0 commit comments

Comments
 (0)