You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#pragma warning restore CA1815 // Override equals and operator equals on value types
{
[JsonConverter(typeof(JsonStringEnumConverter))]
publicMessageTypeMessageType{get;set;}
So we will have to wait until that bug is fixed.
Here are the current warnings from this project:
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Services\Reconciler.cs(62,36,62,82): warning IL3050: Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Services\Reconciler.cs(63,36,63,70): warning IL3050: Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Services\Reconciler.cs(62,36,62,82): warning IL2026: 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Services\Reconciler.cs(63,36,63,70): warning IL2026: 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Protocol\DispatchConfigProvider.cs(33,21,33,65): warning IL3050: Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Protocol\DispatchConfigProvider.cs(33,21,33,65): warning IL2026: Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Management\KubernetesReverseProxyServiceCollectionExtensions.cs(83,9,83,67): warning IL3050: Using member 'Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<TOptions>(IServiceCollection, IConfiguration)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. Binding strongly typed objects to configuration values may require generating dynamic code at runtime.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Management\KubernetesReverseProxyServiceCollectionExtensions.cs(83,9,83,67): warning IL2026: Using member 'Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<TOptions>(IServiceCollection, IConfiguration)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Protocol\DispatchActionResult.cs(57,29,60,15): warning IL3050: Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<TValue>(TValue, 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Protocol\DispatchActionResult.cs(57,29,60,15): warning IL2026: Using member 'System.Text.Json.JsonSerializer.SerializeToUtf8Bytes<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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Protocol\Receiver.cs(75,35,75,93): warning IL3050: Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(String, 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.
1>C:\git\reverse-proxy\src\Kubernetes.Controller\Protocol\Receiver.cs(75,35,75,93): warning IL2026: Using member 'System.Text.Json.JsonSerializer.Deserialize<TValue>(String, 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.
Why is this important to you?
This allows Yarp.Kubernetes.Controller to be used in a Native AOT app, which has smaller disk footprint, faster start up, and less memory consumption.
The text was updated successfully, but these errors were encountered:
* Enable AOT compatibility for Yarp.Telemetry.Consumption
Also fix a simple warning in Yarp.Kubernetes.Controller. The rest of the warnings in this project will be addressed in #2145.
* Fix TryAddSingleton warning that isn't caught by the Roslyn analyzer.
See https://github.com/dotnet/runtime/issues/86720 for why the warning isn't being raised.
What should we add or change to make your life better?
Address all trimming and AOT warnings in Yarp.Kubernetes.Controller.
The current warnings are from 2 API usages:
Both of these APIs use unbounded runtime Reflection. There are 2 general approaches to resolving these warnings:
I would suggest using the Source Generators.
Note that using the JSON Source Generator right now isn't possible because of dotnet/runtime#79311. We need this functionality to serialize a
Message
:reverse-proxy/src/Kubernetes.Controller/Protocol/Message.cs
Lines 18 to 22 in 7ef8164
So we will have to wait until that bug is fixed.
Here are the current warnings from this project:
Why is this important to you?
This allows Yarp.Kubernetes.Controller to be used in a Native AOT app, which has smaller disk footprint, faster start up, and less memory consumption.
The text was updated successfully, but these errors were encountered: