Skip to content

Conversation

@trrwilson
Copy link
Collaborator

As reported:

As described in this dotnet runtime issue, some environments encounter a peculiarity with explicit interface method implementations involving covariant generics:

dotnet/runtime#103365

This manifests as several derived types, most notably the one used for chat messages, inappropriately invoking the serialization logic for the abstract base type rather than the intended derived type -- meaning we don't serialize the important content value and send invalid requests.

Pending runtime resolution, this change aligns this library's impacted request types with a better practice of managing serialization in an overrideable WriteCore(); this means that, even with the covariant oddity invoking the wrong instantiation of the explicit interface, we'll use the correct serialization logic from the downcast type.

@trrwilson trrwilson merged commit 896b9e0 into main Jun 14, 2024
@trrwilson trrwilson deleted the user/travisw/covariance-serialization-mitigation branch June 14, 2024 21:04
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.

System.ClientModel.ClientResultException: 'HTTP 400 (invalid_request_error: )

3 participants