Add JsonSerializerContext support for Native AOT compatibility in OllamaSharp integration#1092
Merged
aaronpowell merged 4 commits intomainfrom Jan 13, 2026
Merged
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add option to pass JsonSerializerContext to Ollama
Add JsonSerializerContext support for Native AOT compatibility in OllamaSharp integration
Jan 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Native AOT compatibility to the OllamaSharp integration by exposing the JsonSerializerContext configuration option. OllamaSharp requires a custom JsonSerializerContext for Native AOT scenarios, but the Aspire integration previously did not allow passing this configuration.
Changes:
- Added
JsonSerializerContextproperty toOllamaSharpSettingswith XML documentation - Updated
OllamaApiClientinstantiation to use constructor acceptingJsonSerializerContext - Added comprehensive test coverage for both keyed and non-keyed client scenarios
- Added Native AOT Support section to README with usage examples
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.OllamaSharp/OllamaSharpSettings.cs | Added JsonSerializerContext property with XML documentation linking to OllamaSharp's AOT docs |
| src/CommunityToolkit.Aspire.OllamaSharp/AspireOllamaSharpExtensions.cs | Updated client instantiation to pass SelectedModel and JsonSerializerContext to constructor |
| tests/CommunityToolkit.Aspire.OllamaSharp.Tests/OllamaApiClientTests.cs | Added tests verifying JsonSerializerContext is properly passed for keyed and non-keyed clients, plus test with settings overload |
| tests/CommunityToolkit.Aspire.OllamaSharp.Tests/ConfigurationTests.cs | Added test verifying JsonSerializerContext is null by default |
| src/CommunityToolkit.Aspire.OllamaSharp/README.md | Added Native AOT Support section with example usage and link to OllamaSharp documentation |
This was referenced Jan 14, 2026
Bump CommunityToolkit.Aspire.Hosting.Flagd from 13.0.0 to 13.1.0
askpt/openfeature-aspire-sample#270
Closed
Closed
This was referenced Feb 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OllamaSharp supports Native AOT when provided with a
JsonSerializerContext, but the Aspire integration did not expose this configuration option.Changes
JsonSerializerContextproperty with XML documentation referencing OllamaSharp's AOT docsOllamaApiClientinstantiation to use constructor overload acceptingJsonSerializerContextandselectedModelUsage
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
awaescher.github.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
JsonSerializerContextto Ollama #1084💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.