Skip to content

Commit afc57dd

Browse files
Copilotstephentoub
andauthored
Fix netstandard2.0 build: use Split(char) instead of Split(char, StringSplitOptions)
Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/5e730596-6a29-45ba-8610-4bc03424893e Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent e213557 commit afc57dd

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,20 @@ private async Task PerformDynamicClientRegistrationAsync(
736736
// all previously requested scopes to prevent losing previously granted permissions.
737737
if (_lastRequestedScopes is not null && newScopes is not null)
738738
{
739-
var combined = new HashSet<string>(_lastRequestedScopes.Split(' ', StringSplitOptions.RemoveEmptyEntries), StringComparer.Ordinal);
740-
foreach (var scope in newScopes.Split(' ', StringSplitOptions.RemoveEmptyEntries))
739+
var combined = new HashSet<string>(StringComparer.Ordinal);
740+
foreach (var scope in _lastRequestedScopes.Split(' '))
741741
{
742-
combined.Add(scope);
742+
if (scope.Length > 0)
743+
{
744+
combined.Add(scope);
745+
}
746+
}
747+
foreach (var scope in newScopes.Split(' '))
748+
{
749+
if (scope.Length > 0)
750+
{
751+
combined.Add(scope);
752+
}
743753
}
744754
newScopes = string.Join(" ", combined);
745755
}

0 commit comments

Comments
 (0)