Skip to content

support AOT compilation #1466

Description

@mizantrop777

What problem is this feature trying to solve?

with native AOT compilation (publish):
I'm trying to download an item from the workshop, but I'm getting an error here:

public async Task<PublishedFileDetails> GetPublishedFileDetails(uint appId, PublishedFileID pubFile)
{
    //ProtoBuf.Meta.RuntimeTypeModel.Default.AutoCompile = false;
    //ProtoBuf.Meta.RuntimeTypeModel.Default.CompileInPlace();
    var pubFileRequest = new CPublishedFile_GetDetails_Request
    {
        appid = appId
    };
    pubFileRequest.publishedfileids.Add(pubFile);

    var callback = await steamPublishedFile.GetDetails(pubFileRequest);

    if (callback.Result == EResult.OK)
    {
        var response = callback.Body;
        return response.publishedfiledetails.FirstOrDefault();
    }

    throw new Exception($"EResult {(int)callback.Result} ({callback.Result}) while retrieving file details for pubfile {pubFile}.");
}

Error: 'ProtoBuf.Serializers.RepeatedSerializer.CreateList[System.UInt64]()' is missing native code. MethodInfo.MakeGenericMethod() is not compatible with AOT compilation. Inspect and fix AOT related warnings that were generated when the app was published. For more information see https://aka.ms/nativeaot-compatibility

How would you like it to be solved?

I would like this to work with AOT compilation. I think the problem is with protobuf-net

Have you considered any alternative solutions

maybe switching to Google.protobuf will solve this problem. I tried to do it myself, but it's too difficult for me =(

That didn't help either:
ProtoBuf.Meta.RuntimeTypeModel.Default.AutoCompile = false;
ProtoBuf.Meta.RuntimeTypeModel.Default.CompileInPlace();

Additional Information

No response

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions