Remove System.Linq.Async dependency from src assemblies (#1069)

We shouldn't be shipping any more dependencies on this package, as it's becoming legacy, replaced by System.Linq.AsyncEnumerable.

We'll eventually want to replace it with System.Linq.AsyncEnumerable in all tests/samples, too, but that's hard to do until SK updates to use S.L.AsyncEnumerable once its 10.0.0 version is released. I did remove the package reference from tests/samples where it's not needed.
This commit is contained in:
Stephen Toub
2025-10-01 13:17:21 -04:00
committed by GitHub
Unverified
parent ae4cb7d44a
commit 0fef277c70
25 changed files with 14 additions and 27 deletions
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Agents.AI.Workflows.Declarative.Extensions;
@@ -21,13 +21,17 @@ internal sealed class RetrieveConversationMessagesExecutor(RetrieveConversationM
Throw.IfNull(this.Model.ConversationId, $"{nameof(this.Model)}.{nameof(this.Model.ConversationId)}");
string conversationId = this.Evaluator.GetValue(this.Model.ConversationId).Value;
ChatMessage[] messages = await agentProvider.GetMessagesAsync(
List<ChatMessage> messages = [];
await foreach (var m in agentProvider.GetMessagesAsync(
conversationId,
limit: this.GetLimit(),
after: this.GetMessage(this.Model.MessageAfter),
before: this.GetMessage(this.Model.MessageBefore),
newestFirst: this.IsDescending(),
cancellationToken).ToArrayAsync(cancellationToken).ConfigureAwait(false);
cancellationToken).ConfigureAwait(false))
{
messages.Add(m);
}
await this.AssignAsync(this.Model.Messages?.Path, messages.ToTable(), context).ConfigureAwait(false);