Skip to content

Compatibility with AOT #34

Open
Open

Description

@stalek71

Is it compatible with AOT compilation?
I’m asking because I see the following warning, for example:

JsonSerializerContext.cs(15,22,15,51): warning SYSLIB1034: 
The member 'GeoJSON.Text.Geometry.Point.Type' has been annotated with 'JsonStringEnumConverter'  which is not supported in native AOT.
Consider using the generic 'JsonStringEnumConverter<TEnum>' instead. 

Activity

  1. xfischer commented on May 28, 2025

    @xfischer
    Member

    Hi @stalek71 thanks for reporting.
    AOT is not officially supported yet. Is that something you'd be interested in ?

  2. stalek71 commented on May 28, 2025

    @stalek71
    Author

    Hi,
    yes, I compile the code to native form for both x64 and arm64. For now, I'm running the code with GeoJson without converting it to AOT, but once I finish converting the project that uses it, I plan to deploy native code to the cluster.

  3. Captainpast commented on Sep 23, 2025

    @Captainpast
    Contributor

    AOT should be possible since #31, by writing an own JsonSerializerContext.
    But, there is no release containing it.

  4. rabbitism commented on Dec 6, 2025

    @rabbitism

    https://github.com/irihitech/Irihi.GeoJSON.Text

    We spent some time to make this library AOT compatible, there might be some corner cases, but should be production ready for common scenarios.

    It's a big change compared to current branch head, maybe you can review first to see if you want to accept my pull request. @xfischer

  5. xfischer commented on Dec 11, 2025

    @xfischer
    Member

    Sorry guys, I'm quite busy, will have a look tomorrow

  6. rabbitism commented on Dec 12, 2025

    @rabbitism

    Sorry guys, I'm quite busy, will have a look tomorrow

    I think I made too many irrelative changes; I will submit PR from other branches.
    Key changes to make it AOT compatible:

    1. Pass JsonSerializerOptions down if possible
    2. Use type instead of interface in JsonConverters. Example: PolygonEnumerableConverter should implement JsonConverter<ReadOnlyCollection<Polygon>> instead of JsonConverter<IReadOnlyCollection<Polygon>>
    3. Use JsonStringEnumConverter<T> for NET8 or greater. This is only available after NET8, but it is okay from AOT perspective because AOT is only meaningful after NET8.
    4. For enum members, instead of using EnumMember and use reflection to get lowercase names, just use JsonStringEnumMemberName for NET8 or greater.
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