Skip to content

fix(dotnet): tolerate numeric ping timestamps - #2199

Closed
xianjianlf2 wants to merge 1 commit into
github:mainfrom
xianjianlf2:fix/dotnet-ping-timestamp-compat
Closed

fix(dotnet): tolerate numeric ping timestamps#2199
xianjianlf2 wants to merge 1 commit into
github:mainfrom
xianjianlf2:fix/dotnet-ping-timestamp-compat

Conversation

@xianjianlf2

Copy link
Copy Markdown
Contributor

Fixes #2091.

Summary

  • apply the existing DateTimeOffset timestamp converter to PingResponse.Timestamp
  • extend that converter to accept ISO-8601 strings, numeric epoch milliseconds, and stringified epoch milliseconds
  • apply the same converter to generated Rpc.PingResult.Timestamp through the C# generator and current generated output
  • add serialization tests for both public and typed RPC ping result shapes

Root cause

PingResponse.Timestamp and generated Rpc.PingResult.Timestamp used the default DateTimeOffset JSON converter, which expects a string and rejects older numeric epoch-millisecond payloads from some CLI builds. Since ping is used during startup protocol verification, that deserialization error prevents the .NET client from starting.

Validation

  • Not run: dotnet test test/GitHub.Copilot.SDK.Test.csproj --filter SerializationTests could not run because dotnet is not installed in this environment (zsh:1: command not found: dotnet).

@xianjianlf2
xianjianlf2 marked this pull request as ready for review August 1, 2026 08:23
@xianjianlf2
xianjianlf2 requested a review from a team as a code owner August 1, 2026 08:23
@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Thanks for the contribution, @xianjianlf2. However since we don't support using mismatched SDK and runtime versions (especially not radically mismatches ones as in this issue), it's not something we'd want to add support for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The JSON value could not be converted to System.DateTimeOffset

2 participants