Skip to content

Enable IsAotCompatible#96

Open
campersau wants to merge 6 commits intotestcontainers:mainfrom
campersau:aot
Open

Enable IsAotCompatible#96
campersau wants to merge 6 commits intotestcontainers:mainfrom
campersau:aot

Conversation

@campersau
Copy link
Copy Markdown

@campersau campersau commented Mar 30, 2026

  • Enable IsAotCompatible
  • Generate DockerModelsJsonSerializerContext with all docker API models which have JSON parameters, so query string only models are not added for JsonSerialization
  • Add DockerExtendedJsonSerializerContext which includes types directly used by *Operations (this can be removed / merged with DockerModelsJsonSerializerContext when STJ source generator fails when defining the serializer context in 2 partial classes dotnet/runtime#99669 is available)
  • Update reflection APIs with DynamicallyAccessedMembers attributes
  • Update xunit to xunit.v3.aot.mtp-v2 4.0.0-pre.33 which is still in preview but required to actually test AOT.
  • Use xunit.v3.mtp-v2 4.0.0-pre.33 for .NET 8.0 because xunit AOT only works from .NET 9 onwards.
  • Cleanup preprocessor directives
  • Change all IEnumerable responses to be IList for consistency (breaking change)
  • Use generic QueryStringParameter to reduce reflection

fixes #88

@campersau
Copy link
Copy Markdown
Author

campersau commented Apr 1, 2026

Before (main)

Method Mean Error StdDev Allocated
CreateContainerRequestResponse 190.7 ms 107.9 ms 5.91 ms 34.55 KB
StartContainerRequestResponse 717.5 ms 371.3 ms 20.35 ms 47.59 KB

Docker.DotNet.dll 464 KB (475.648 Bytes)

image

After (AoT)

Method Mean Error StdDev Allocated
CreateContainerRequestResponse 185.8 ms 109.1 ms 5.98 ms 41.77 KB
StartContainerRequestResponse 702.5 ms 478.7 ms 26.24 ms 68.9 KB

Docker.DotNet.dll 3,01 MB (3.162.112 Bytes)

image

@HofmeisterAn
Copy link
Copy Markdown
Collaborator

FYI: I will need a few days for the review. I'm pretty busy this week.

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.

Make the library compatible with Native AOT

2 participants