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
Describe the bug
It looks like SourceGenerationContext lacks JSON serialization metadata for the V1Patch type, which causes patch requests to fail in AOT scenarios.
Kubernetes C# SDK Client Version 15.0.1
Server Kubernetes Version 1.30.0
Dotnet Runtime Version net9.0, though this is likely reproducible across AOT compatible TFM's
To Reproduce
Attempt to patch some k8s config using one of the Patch... methods on the Kubernetes client that takes V1Patch while using the Kubernetes.Aot package.
Expected behavior
Configuration to update successfully.
Where do you run your app with Kubernetes SDK (please complete the following information):
OS: Windows
Environment: Local (Desktop, ARM Laptop)
Cloud: No, local cluster
Additional context
I've fixed this in a local version of the package by just adding a second JsonSerializerContext just for V1Patch, and in KubernetesJson.Serialize checking both contexts for type info (commit):
I've only seen the use case so far where the body of the V1Patch object is already a JSON string. In that case, I think it would be viable to special case it and skip serialization altogether, and just return the body as string, that would enable some level of support in AOT scenarios.
It would be good to get some level of patch support into the AOT version of the library.
If that sounds reasonable, I would be happy to contribute.
Describe the bug
It looks like
SourceGenerationContext
lacks JSON serialization metadata for theV1Patch
type, which causes patch requests to fail in AOT scenarios.Kubernetes C# SDK Client Version
15.0.1
Server Kubernetes Version
1.30.0
Dotnet Runtime Version
net9.0
, though this is likely reproducible across AOT compatible TFM'sTo Reproduce
Attempt to patch some k8s config using one of the
Patch...
methods on the Kubernetes client that takesV1Patch
while using theKubernetes.Aot
package.Expected behavior
Configuration to update successfully.
Where do you run your app with Kubernetes SDK (please complete the following information):
Additional context
I've fixed this in a local version of the package by just adding a second
JsonSerializerContext
just forV1Patch
, and inKubernetesJson.Serialize
checking both contexts for type info (commit):I appreciate this is a suboptimal solution. Unfortunately I get build errors adding
V1Patch
toSourceGenerationContext
.The text was updated successfully, but these errors were encountered: