samcragg / sharpkml

SharpKML is an implementation of the Open Geospatial Consortium (OGC) KML 2.2 standard developed in C#, able to read/write both KML files and KMZ files.
MIT License
158 stars 51 forks source link

Support for NativeAOT / full trimming #54

Open tipa opened 3 weeks ago

tipa commented 3 weeks ago

At the moment, the library is not trimming safe an building an app with NativeAOT produces this warning: warning IL2104: Assembly 'SharpKml.Core' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries

Currently, in my .NET Mac App I have to manually exclude certain types from being linked away (using an LinkDescription.xml file) - otherwise the app crashes when using the library:

<?xml version="1.0" encoding="utf-8"?>
<linker>
  <assembly fullname="SharpKml.Core">
    <type fullname="SharpKml.Dom.*" />
  </assembly>
</linker>

Making the app trimming-safe would fix both the warning and the need for this workaround