Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate message content serialization problems in mono/wasm/etc. #58

Merged
merged 1 commit into from
Jun 14, 2024

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
1 check passed
@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: )
2 participants