Open
Description
I was testing with a simple application with Native AOT and got problems:
using Docker.DotNet;
using Docker.DotNet.Models;
var client = new DockerClientConfiguration()
.CreateClient();
var param = new ImagesListParameters
{
All = true
};
var images = await client.Images.ListImagesAsync(param);
This sample only works if i add <TrimMode>partial</TrimMode>
to my csproject, add this class:
namespace Docker.DotNet;
using System.Text.Json.Serialization;
using Models;
[JsonSerializable(typeof(ImagesListResponse[]))]
[JsonSerializable(typeof(ImagesListParameters[]))]
public partial class JsonSerializerContext :System.Text.Json.Serialization.JsonSerializerContext {}
And set the TypeInfoResolver
on JsonSerializerOptions
to JsonSerializerContext.Default
.
It seems that all serializable models must be added to the JsonSerializerContext, are you planning to automate this?
Metadata
Metadata
Assignees
Labels
No labels
Activity