From 1a99d9928e86c83c1c718b8dcd84a9300ff6aa62 Mon Sep 17 00:00:00 2001 From: tobias-tengler <45513122+tobias-tengler@users.noreply.github.com> Date: Fri, 6 Feb 2026 16:42:18 +0100 Subject: [PATCH] Fix build failures --- .../Extensions/ServiceCollectionExtensions.cs | 4 ---- .../src/Transport.Http/Json/JsonResultEnumerable.cs | 5 +++-- .../src/CommandLine/Commands/Mcp/McpCommand.cs | 8 ++++++++ .../src/CommandLine/Commands/OpenApi/OpenApiCommand.cs | 8 ++++++++ 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/ServiceCollectionExtensions.cs b/src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/ServiceCollectionExtensions.cs index ef97baec7f6..ff4046cf9a6 100644 --- a/src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/ServiceCollectionExtensions.cs +++ b/src/HotChocolate/Adapters/src/Adapters.Mcp.Core/Extensions/ServiceCollectionExtensions.cs @@ -30,11 +30,7 @@ public static void AddMcpServices(this IServiceCollection services, string schem static (sp, name) => new McpRequestExecutorProxy( sp.GetRequiredService(), sp.GetRequiredService(), -#if NET10_0_OR_GREATER - (string)name)) -#else (string)name!)) -#endif .AddKeyedSingleton( schemaName, static (sp, name) => new StreamableHttpHandlerProxy( diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/Json/JsonResultEnumerable.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/Json/JsonResultEnumerable.cs index 4b84d4061f7..ca5cfc96e1f 100644 --- a/src/HotChocolate/AspNetCore/src/Transport.Http/Json/JsonResultEnumerable.cs +++ b/src/HotChocolate/AspNetCore/src/Transport.Http/Json/JsonResultEnumerable.cs @@ -2,6 +2,7 @@ using System.Buffers; using System.IO.Pipelines; using System.Text.Json; +using HotChocolate.Buffers; using HotChocolate.Fusion.Text.Json; #else using System.Buffers; @@ -53,7 +54,7 @@ public async IAsyncEnumerator GetAsyncEnumerator( #if FUSION var chunks = ArrayPool.Shared.Rent(64); - var currentChunk = JsonMemory.Rent(); + var currentChunk = JsonMemory.Rent(JsonMemoryKind.Json); var currentChunkPosition = 0; var chunkIndex = 0; #else @@ -101,7 +102,7 @@ public async IAsyncEnumerator GetAsyncEnumerator( } chunks[chunkIndex++] = currentChunk; - currentChunk = JsonMemory.Rent(); + currentChunk = JsonMemory.Rent(JsonMemoryKind.Json); currentChunkPosition = 0; } } diff --git a/src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/McpCommand.cs b/src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/McpCommand.cs index 04744b17141..e690a27103f 100644 --- a/src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/McpCommand.cs +++ b/src/Nitro/CommandLine/src/CommandLine/Commands/Mcp/McpCommand.cs @@ -1,5 +1,13 @@ +#if !NET9_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif + namespace ChilliCream.Nitro.CommandLine.Commands.Mcp; +#if !NET9_0_OR_GREATER +[RequiresDynamicCode("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.")] +[RequiresUnreferencedCode("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.")] +#endif internal sealed class McpCommand : Command { public McpCommand() : base("mcp") diff --git a/src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/OpenApiCommand.cs b/src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/OpenApiCommand.cs index 467dd221a3c..50ffd8bb6ec 100644 --- a/src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/OpenApiCommand.cs +++ b/src/Nitro/CommandLine/src/CommandLine/Commands/OpenApi/OpenApiCommand.cs @@ -1,5 +1,13 @@ +#if !NET9_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif + namespace ChilliCream.Nitro.CommandLine.Commands.OpenApi; +#if !NET9_0_OR_GREATER +[RequiresDynamicCode("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.")] +[RequiresUnreferencedCode("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.")] +#endif internal sealed class OpenApiCommand : Command { public OpenApiCommand() : base("openapi")