From 02b8c928dba428cbbf185cb37c09093501b122d9 Mon Sep 17 00:00:00 2001 From: Jacob Alber Date: Wed, 13 May 2026 13:15:01 -0400 Subject: [PATCH] Fix isolation key provider nullability semantics Co-authored-by: lokitoth <6936551+lokitoth@users.noreply.github.com> --- .../IsolationKeyScopedAgentSessionStore.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting/IsolationKeyScopedAgentSessionStore.cs b/dotnet/src/Microsoft.Agents.AI.Hosting/IsolationKeyScopedAgentSessionStore.cs index a967c35f28..d246abeb16 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting/IsolationKeyScopedAgentSessionStore.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting/IsolationKeyScopedAgentSessionStore.cs @@ -14,7 +14,7 @@ namespace Microsoft.Agents.AI.Hosting; /// public class IsolationKeyScopedAgentSessionStore : DelegatingAgentSessionStore { - private readonly SessionIsolationKeyProvider _keyProvider; + private readonly SessionIsolationKeyProvider? _keyProvider; private readonly bool _strict; /// @@ -34,7 +34,7 @@ public class IsolationKeyScopedAgentSessionStore : DelegatingAgentSessionStore IsolationKeyScopedAgentSessionStoreOptions? options = null) : base(innerStore) { - this._keyProvider = Throw.IfNull(keyProvider); + this._keyProvider = keyProvider; options ??= new IsolationKeyScopedAgentSessionStoreOptions(); this._strict = options.Strict; } @@ -51,7 +51,9 @@ public class IsolationKeyScopedAgentSessionStore : DelegatingAgentSessionStore /// private async ValueTask GetIsolationKeyAsync(CancellationToken cancellationToken) { - string? key = await this._keyProvider.GetSessionIsolationKeyAsync(cancellationToken).ConfigureAwait(false); + string? key = this._keyProvider != null + ? await this._keyProvider.GetSessionIsolationKeyAsync(cancellationToken).ConfigureAwait(false) + : null; if (this._strict && key == null) {