Skip to content

Commit bb67609

Browse files
.Net: Prepare code for A2A SDK and AsyncEnumerable NuGet update (#12842)
### Motivation, Context and Description This PR prepares the SK codebase for a future update of the A2A agent to the new A2A .NET SDK and establishes the foundation for easy adoption of the System.Linq.AsyncEnumerable package when it released. This will completely eliminate the need for the AsyncEnumerable polyfills that SK currently uses. As part of this preparation, this PR stops using of the System.Linq.Async package and replaces all SK calls to its APIs with either equivalent calls to the AsyncEnumerable polyfills or in-place implementations. This prevents "The call is ambiguous between..." name conflicts that would occur when the AsyncEnumerable APIs from the A2A .NET SDK's transitive dependency (System.Linq.AsyncEnumerable) become available to the Agents.UnitTests project, which already contains equivalent APIs from either AsyncEnumerable polyfills and/or the System.Linq.Async package brought in from other projects that have the Agents.UnitTests project specified as "InternalVisibleTo". As a result, almost all non-production code (tests and samples) uses AsyncEnumerable APIs from the preview version of the System.Linq.AsyncEnumerable package, while production code uses either AsyncEnumerable APIs from polyfills or uses in-place implementations.
1 parent 53c5a3b commit bb67609

File tree

43 files changed

+294
-264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+294
-264
lines changed

dotnet/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
8686
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />
8787
<PackageVersion Include="System.IO.Packaging" Version="8.0.1" />
88-
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
88+
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.5.25277.114" />
8989
<PackageVersion Include="System.Memory.Data" Version="8.0.1" />
9090
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
9191
<PackageVersion Include="System.Numerics.Tensors" Version="9.0.7" />

dotnet/samples/Concepts/Concepts.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
4545
<PackageReference Include="Microsoft.ML.Tokenizers" />
4646
<PackageReference Include="Microsoft.OpenApi" />
47-
<PackageReference Include="System.Linq.Async" />
4847
<PackageReference Include="System.Numerics.Tensors" />
4948
<PackageReference Include="AWSSDK.Core" />
5049
<PackageReference Include="AWSSDK.SecurityToken" />
@@ -97,6 +96,10 @@
9796
<ProjectReference Include="..\..\src\SemanticKernel.Core\SemanticKernel.Core.csproj" />
9897
</ItemGroup>
9998

99+
<ItemGroup>
100+
<Compile Include="$(RepoRoot)/dotnet/src/InternalUtilities/src/Linq/AsyncEnumerable.cs" Link="%(RecursiveDir)Utilities/%(Filename)%(Extension)" />
101+
</ItemGroup>
102+
100103
<ItemGroup>
101104
<Using Include="Xunit" />
102105
<Using Include="Xunit.Abstractions" />

dotnet/samples/Demos/ModelContextProtocolClientServer/MCPClient/MCPClient.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
1414
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
1515
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
16+
<PackageReference Include="System.Linq.AsyncEnumerable" />
1617
</ItemGroup>
1718

1819
<ItemGroup>

dotnet/samples/Demos/ModelContextProtocolPlugin/ModelContextProtocolPlugin.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
1515
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
1616
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
17+
<PackageReference Include="System.Linq.AsyncEnumerable" />
1718
</ItemGroup>
1819

1920
<ItemGroup>

dotnet/samples/Demos/ModelContextProtocolPluginAuth/ModelContextProtocolPluginAuth.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" />
1616
<PackageReference Include="Microsoft.Extensions.Logging.Debug" />
1717
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
18+
<PackageReference Include="System.Linq.AsyncEnumerable" />
1819
</ItemGroup>
19-
20+
2021
<ItemGroup>
2122
<ProjectReference Include="..\..\..\src\Agents\Abstractions\Agents.Abstractions.csproj" />
2223
<ProjectReference Include="..\..\..\src\Agents\Core\Agents.Core.csproj" />

dotnet/samples/GettingStarted/GettingStarted.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
<PackageReference Include="Microsoft.Extensions.Logging" />
4848
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
4949
<PackageReference Include="Microsoft.ML.Tokenizers" />
50-
<PackageReference Include="System.Linq.Async" />
5150
<PackageReference Include="System.Numerics.Tensors" />
5251
</ItemGroup>
5352

dotnet/samples/GettingStartedWithAgents/GettingStartedWithAgents.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
3131
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
3232
<PackageReference Include="OpenTelemetry.Exporter.Console" />
33+
<PackageReference Include="System.Linq.AsyncEnumerable" />
3334
<PackageReference Include="coverlet.collector" />
3435
<PackageReference Include="Microsoft.NET.Test.Sdk" />
3536
<PackageReference Include="xunit" />

dotnet/samples/GettingStartedWithProcesses/GettingStartedWithProcesses.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<PackageReference Include="xunit" />
3636
<PackageReference Include="xunit.abstractions" />
3737
<PackageReference Include="xunit.runner.visualstudio" />
38+
<PackageReference Include="System.Linq.AsyncEnumerable" />
3839
</ItemGroup>
3940

4041
<Import Project="$(RepoRoot)/dotnet/src/InternalUtilities/samples/SamplesInternalUtilities.props" />

dotnet/samples/GettingStartedWithTextSearch/GettingStartedWithTextSearch.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
<PackageReference Include="Microsoft.Extensions.Logging" />
3535
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
3636
<PackageReference Include="Microsoft.ML.Tokenizers" />
37-
<PackageReference Include="System.Linq.Async" />
3837
<PackageReference Include="System.Numerics.Tensors" />
38+
<PackageReference Include="System.Linq.AsyncEnumerable" />
3939
</ItemGroup>
4040

4141
<Import Project="$(RepoRoot)/dotnet/src/InternalUtilities/samples/SamplesInternalUtilities.props" />

dotnet/samples/GettingStartedWithVectorStores/GettingStartedWithVectorStores.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
3333
<PackageReference Include="Microsoft.Extensions.Logging" />
3434
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
35-
<PackageReference Include="System.Linq.Async" />
3635
<PackageReference Include="System.Text.Json" />
36+
<PackageReference Include="System.Linq.AsyncEnumerable" />
3737
</ItemGroup>
3838

3939
<Import Project="$(RepoRoot)/dotnet/src/InternalUtilities/samples/SamplesInternalUtilities.props" />

0 commit comments

Comments
 (0)