Uh oh!
There was an error while loading. Please reload this page.
.NET: Improve session cast error message quality and consistency - #3973
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the clarity and consistency of error messages when session type mismatches occur during agent operations. The changes address feedback from issue #3677 that the previous error messages were unclear about whether they referred to the agent instance or the agent type.
Changes:
- Updated all session type mismatch error messages to include both the actual session type name and the expected session type name
- Standardized error message format across all agent implementations (ChatClientAgent, CopilotStudioAgent, A2AAgent, GitHubCopilotAgent, DurableAIAgent, DurableAIAgentProxy, WorkflowHostAgent)
- Applied consistent error messages in test agent implementations
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs | Updated session type mismatch errors in SerializeSessionCoreAsync and RunCoreStreamingAsync to include actual and expected type names |
| dotnet/src/Microsoft.Agents.AI.CopilotStudio/CopilotStudioAgent.cs | Updated session type mismatch errors in SerializeSessionCoreAsync, RunCoreAsync, and RunCoreStreamingAsync |
| dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs | Updated session type mismatch errors in SerializeSessionCoreAsync and GetA2ASessionAsync |
| dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs | Updated session type mismatch errors in SerializeSessionCoreAsync and RunCoreStreamingAsync to use consistent format |
| dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs | Updated session type mismatch error in SerializeSessionCoreAsync |
| dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgentProxy.cs | Updated session type mismatch error in SerializeSessionCoreAsync |
| dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs | Updated session type mismatch error in SerializeSessionCoreAsync |
| dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs | Updated session type mismatch error in test agent |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.UnitTests/AGUIEndpointRouteBuilderExtensionsTests.cs | Updated session type mismatch errors in test agents |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/SharedStateTests.cs | Updated session type mismatch error in test agent |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/ForwardedPropertiesTests.cs | Updated session type mismatch error in test agent |
| dotnet/tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/BasicStreamingTests.cs | Updated session type mismatch error in test agent |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Motivation and Context
#3677
Description
Contribution Checklist