Skip to content

Support for Native AOT #689

Open
Open
@JuanCalle1606

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions