Strawberry Shake | NativeAOT / Trimming Support #8406
DominicMaas
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, was wondering if any thoughts have been put into NativeAOT / Trimming support for Strawberry Shake?
From what I can tell, trimming seems to work, with just two of the same warning (in my Windows client). Haven't encountered any regressions in the wild yet.
Wanted to know if there has been any prior work before attempting to give this a go.
Trim analysis warning IL2026: HotChocolate.Transport.Http.DefaultGraphQLHttpClient.CreateGetRequestUri(ArrayWriter, Uri, IRequestBody): Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Attempting AOT has a few errors though (I'm not as concerned with this AOT support at the moment, but would be nice in the future as the eco-system starts supporting it more and more)
AOT analysis error IL3050: MemoryPack.Internal.TypeHelpers.Cache1..cctor(): Using member 'System.Reflection.MethodInfo.MakeGenericMethod(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime.
Trim analysis error IL2060: MemoryPack.Internal.TypeHelpers.Cache1..cctor(): Call to 'System.Reflection.MethodInfo.MakeGenericMethod(Type[])' can not be statically analyzed. It's not possible to guarantee the availability of requirements of the generic method.
Trim analysis error IL2026: HotChocolate.Transport.Http.DefaultGraphQLHttpClient.CreateGetRequestUri(ArrayWriter,Uri,IRequestBody): Using member 'System.Text.Json.JsonSerializer.Serialize<IReadOnlyDictionary2<String,Object>>(IReadOnlyDictionary2<String,Object> ,JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
AOT analysis error IL3050: HotChocolate.Transport.Http.DefaultGraphQLHttpClient.CreateGetRequestUri(ArrayWriter,Uri,IRequestBody): Using member 'System.Text.Json.JsonSerializer.Serialize<IReadOnlyDictionary2<String,Object>>(IReadOnlyDictionary2<String,Object>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.
Trim analysis error IL2026: HotChocolate.Transport.Http.DefaultGraphQLHttpClient.CreateGetRequestUri(ArrayWriter,Uri,IRequestBody): Using member 'System.Text.Json.JsonSerializer.Serialize<IReadOnlyDictionary2<String,Object>>(IReadOnlyDictionary2<String,Object> ,JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
AOT analysis error IL3050: HotChocolate.Transport.Http.DefaultGraphQLHttpClient.CreateGetRequestUri(ArrayWriter,Uri,IRequestBody): Using member 'System.Text.Json.JsonSerializer.Serialize<IReadOnlyDictionary2<String,Object>>(IReadOnlyDictionary2<String,Object>, JsonSerializerOptions)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.
Beta Was this translation helpful? Give feedback.
All reactions