diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 0de4409d53..3ed320863e 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -92,7 +92,7 @@ - + diff --git a/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs b/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs index c966f591fc..e458ddcd85 100644 --- a/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs @@ -274,32 +274,13 @@ private ResumeSessionConfig CreateResumeConfig() } /// - /// Copies all supported properties from a source into a new instance - /// with set to true. + /// Clones a and sets to true. /// internal static SessionConfig CopySessionConfig(SessionConfig source) { - return new SessionConfig - { - Model = source.Model, - ReasoningEffort = source.ReasoningEffort, - Tools = source.Tools, - SystemMessage = source.SystemMessage, - AvailableTools = source.AvailableTools, - ExcludedTools = source.ExcludedTools, - Provider = source.Provider, - OnPermissionRequest = source.OnPermissionRequest, - OnUserInputRequest = source.OnUserInputRequest, - Hooks = source.Hooks, - WorkingDirectory = source.WorkingDirectory, - ConfigDir = source.ConfigDir, - McpServers = source.McpServers, - CustomAgents = source.CustomAgents, - SkillDirectories = source.SkillDirectories, - DisabledSkills = source.DisabledSkills, - InfiniteSessions = source.InfiniteSessions, - Streaming = true - }; + SessionConfig clone = source.Clone(); + clone.Streaming = true; + return clone; } /// diff --git a/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs b/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs index 8a4d3c1068..efd0b60dab 100644 --- a/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs @@ -137,7 +137,8 @@ public void CopySessionConfig_CopiesAllProperties() // Assert Assert.Equal("gpt-4o", result.Model); Assert.Equal("high", result.ReasoningEffort); - Assert.Same(tools, result.Tools); + Assert.NotSame(tools, result.Tools); + Assert.Single(result.Tools!); Assert.Same(systemMessage, result.SystemMessage); Assert.Equal(new List { "tool1", "tool2" }, result.AvailableTools); Assert.Equal(new List { "tool3" }, result.ExcludedTools); @@ -147,7 +148,8 @@ public void CopySessionConfig_CopiesAllProperties() Assert.Same(infiniteSessions, result.InfiniteSessions); Assert.Same(permissionHandler, result.OnPermissionRequest); Assert.Same(userInputHandler, result.OnUserInputRequest); - Assert.Same(mcpServers, result.McpServers); + Assert.NotSame(mcpServers, result.McpServers); + Assert.Single(result.McpServers!); Assert.Equal(new List { "skill1" }, result.DisabledSkills); Assert.True(result.Streaming); }