diff --git a/src/All.slnx b/src/All.slnx
index 5620c0e8200..a0dedb768b2 100644
--- a/src/All.slnx
+++ b/src/All.slnx
@@ -90,9 +90,7 @@
-
-
@@ -112,7 +110,6 @@
-
diff --git a/src/CookieCrumble/src/CookieCrumble.HotChocolate/CookieCrumble.HotChocolate.csproj b/src/CookieCrumble/src/CookieCrumble.HotChocolate/CookieCrumble.HotChocolate.csproj
index d177e47f486..a674bb77188 100644
--- a/src/CookieCrumble/src/CookieCrumble.HotChocolate/CookieCrumble.HotChocolate.csproj
+++ b/src/CookieCrumble/src/CookieCrumble.HotChocolate/CookieCrumble.HotChocolate.csproj
@@ -10,7 +10,6 @@
-
diff --git a/src/HotChocolate/Adapters/src/Adapters.Mcp/HotChocolate.Adapters.Mcp.csproj b/src/HotChocolate/Adapters/src/Adapters.Mcp/HotChocolate.Adapters.Mcp.csproj
index 119b51ea708..6d167c021a3 100644
--- a/src/HotChocolate/Adapters/src/Adapters.Mcp/HotChocolate.Adapters.Mcp.csproj
+++ b/src/HotChocolate/Adapters/src/Adapters.Mcp/HotChocolate.Adapters.Mcp.csproj
@@ -6,7 +6,6 @@
-
diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpResponse.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpResponse.cs
index 4c57bac7179..2281101d5b2 100644
--- a/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpResponse.cs
+++ b/src/HotChocolate/AspNetCore/src/Transport.Http/GraphQLHttpResponse.cs
@@ -1,3 +1,5 @@
+
+using HotChocolate.Buffers;
#if FUSION
using System.Buffers;
using System.Net;
@@ -160,7 +162,7 @@ private async ValueTask ReadAsResultInternalAsync(string? charS
#if FUSION
// we try and read the first chunk into a single chunk.
var reader = PipeReader.Create(stream, s_options);
- var currentChunk = JsonMemory.Rent();
+ var currentChunk = JsonMemory.Rent(JsonMemoryKind.Json);
var currentChunkPosition = 0;
var chunkIndex = 0;
var chunks = ArrayPool.Shared.Rent(64);
@@ -215,7 +217,7 @@ private async ValueTask ReadAsResultInternalAsync(string? charS
}
chunks[chunkIndex++] = currentChunk;
- currentChunk = JsonMemory.Rent();
+ currentChunk = JsonMemory.Rent(JsonMemoryKind.Json);
currentChunkPosition = 0;
}
}
@@ -253,7 +255,7 @@ private async ValueTask ReadAsResultInternalAsync(string? charS
}
chunks[chunkIndex++] = currentChunk;
- currentChunk = JsonMemory.Rent();
+ currentChunk = JsonMemory.Rent(JsonMemoryKind.Json);
currentChunkPosition = 0;
}
}
diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/JsonLines/JsonLinesReader.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/JsonLines/JsonLinesReader.cs
index b8bfef41735..f9896ac4442 100644
--- a/src/HotChocolate/AspNetCore/src/Transport.Http/JsonLines/JsonLinesReader.cs
+++ b/src/HotChocolate/AspNetCore/src/Transport.Http/JsonLines/JsonLinesReader.cs
@@ -2,6 +2,7 @@
using System.Buffers;
using System.IO.Pipelines;
using System.Runtime.CompilerServices;
+using HotChocolate.Buffers;
using HotChocolate.Fusion.Text.Json;
#else
using System.Buffers;
@@ -103,7 +104,7 @@ private static SourceResultDocument ParseDocument(ReadOnlySequence lineBuf
// Ceiling division to make sure we end up with the right amount of chunks.
var chunksNeeded = (requiredSize + JsonMemory.BufferSize - 1) / JsonMemory.BufferSize;
- var chunks = JsonMemory.RentRange(chunksNeeded);
+ var chunks = JsonMemory.RentRange(JsonMemoryKind.Json, chunksNeeded);
var chunkIndex = 0;
var chunkPosition = 0;
diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseEventParser.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseEventParser.cs
index 47d0ba8e6a3..2866a300500 100644
--- a/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseEventParser.cs
+++ b/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseEventParser.cs
@@ -2,7 +2,7 @@
using System.Buffers;
using System.Diagnostics;
using System.Runtime.CompilerServices;
-using HotChocolate.Fusion.Text.Json;
+using HotChocolate.Buffers;
#else
using System.Runtime.CompilerServices;
diff --git a/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseReader.cs b/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseReader.cs
index f7de7d41d38..3348a1e1100 100644
--- a/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseReader.cs
+++ b/src/HotChocolate/AspNetCore/src/Transport.Http/Sse/SseReader.cs
@@ -2,6 +2,7 @@
using System.Buffers;
using System.IO.Pipelines;
using System.Runtime.CompilerServices;
+using HotChocolate.Buffers;
using HotChocolate.Fusion.Text.Json;
#else
using System.Buffers;
@@ -107,7 +108,7 @@ public async IAsyncEnumerator GetAsyncEnumerator(
case SseEventType.Complete:
reader.AdvanceTo(buffer.GetPosition(1, position.Value));
#if FUSION
- JsonMemory.Return(eventBuffers);
+ JsonMemory.Return(JsonMemoryKind.Json, eventBuffers);
eventBuffers.Clear();
#endif
yield break;
@@ -162,7 +163,7 @@ public async IAsyncEnumerator GetAsyncEnumerator(
await reader.CompleteAsync().ConfigureAwait(false);
#if FUSION
// we return whatever is in here.
- JsonMemory.Return(eventBuffers);
+ JsonMemory.Return(JsonMemoryKind.Json, eventBuffers);
#endif
}
}
@@ -232,7 +233,7 @@ private static void WriteBytesToChunks(List chunks, ref int currentPosit
if (chunks.Count == 0 || currentPosition >= JsonMemory.BufferSize)
{
currentPosition = 0;
- chunks.Add(JsonMemory.Rent());
+ chunks.Add(JsonMemory.Rent(JsonMemoryKind.Json));
}
var currentChunk = chunks[^1];
diff --git a/src/HotChocolate/Caching/src/Caching/HotChocolate.Caching.csproj b/src/HotChocolate/Caching/src/Caching/HotChocolate.Caching.csproj
index 19568782fb1..76d0623f5d7 100644
--- a/src/HotChocolate/Caching/src/Caching/HotChocolate.Caching.csproj
+++ b/src/HotChocolate/Caching/src/Caching/HotChocolate.Caching.csproj
@@ -18,7 +18,6 @@
-
diff --git a/src/HotChocolate/Core/HotChocolate.Core.slnx b/src/HotChocolate/Core/HotChocolate.Core.slnx
index 874b0c44d4f..64c576bc86a 100644
--- a/src/HotChocolate/Core/HotChocolate.Core.slnx
+++ b/src/HotChocolate/Core/HotChocolate.Core.slnx
@@ -7,9 +7,7 @@
-
-
@@ -29,7 +27,6 @@
-
diff --git a/src/HotChocolate/Core/src/Authorization/HotChocolate.Authorization.csproj b/src/HotChocolate/Core/src/Authorization/HotChocolate.Authorization.csproj
index 36369fa8d90..c4fea1db81e 100644
--- a/src/HotChocolate/Core/src/Authorization/HotChocolate.Authorization.csproj
+++ b/src/HotChocolate/Core/src/Authorization/HotChocolate.Authorization.csproj
@@ -14,7 +14,7 @@
-
+
diff --git a/src/HotChocolate/Core/src/Core/HotChocolate.Core.csproj b/src/HotChocolate/Core/src/Core/HotChocolate.Core.csproj
index 8c5f1883691..21d8f857b7b 100644
--- a/src/HotChocolate/Core/src/Core/HotChocolate.Core.csproj
+++ b/src/HotChocolate/Core/src/Core/HotChocolate.Core.csproj
@@ -18,8 +18,6 @@
-
-
diff --git a/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelection.cs b/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelection.cs
index 40d92b1dd1e..5de00d5bd0b 100644
--- a/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelection.cs
+++ b/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelection.cs
@@ -96,7 +96,7 @@ public interface ISelection
/// Gets the original syntax nodes that contributed to this selection.
///
///
- /// An enumerable of field nodes from the original GraphQL document that
+ /// An enumerable collection of field nodes from the original GraphQL document that
/// were merged to create this selection. Multiple nodes may be returned
/// if field merging occurred (same response name, compatible arguments).
///
diff --git a/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelectionSet.cs b/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelectionSet.cs
index 7bd3aeef3d3..a64c48f961a 100644
--- a/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelectionSet.cs
+++ b/src/HotChocolate/Core/src/Execution.Operation.Abstractions/ISelectionSet.cs
@@ -2,6 +2,11 @@
namespace HotChocolate.Execution;
+///
+/// A selection set is primarily composed of field selections.
+/// When needed a selection set can preserve fragments so that the execution engine
+/// can branch the processing of these fragments.
+///
public interface ISelectionSet
{
///
diff --git a/src/HotChocolate/Core/src/Execution.Projections/HotChocolate.Execution.Projections.csproj b/src/HotChocolate/Core/src/Execution.Projections/HotChocolate.Execution.Projections.csproj
index 74997ec1546..8e5a544034f 100644
--- a/src/HotChocolate/Core/src/Execution.Projections/HotChocolate.Execution.Projections.csproj
+++ b/src/HotChocolate/Core/src/Execution.Projections/HotChocolate.Execution.Projections.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/HotChocolate/Core/src/Execution/DependencyInjection/Factories/DeferredWorkStateOwnerFactory.cs b/src/HotChocolate/Core/src/Execution/DependencyInjection/Factories/DeferredWorkStateOwnerFactory.cs
deleted file mode 100644
index 0e75c785bae..00000000000
--- a/src/HotChocolate/Core/src/Execution/DependencyInjection/Factories/DeferredWorkStateOwnerFactory.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using HotChocolate.Execution.DependencyInjection;
-using HotChocolate.Execution.Processing;
-using Microsoft.Extensions.ObjectPool;
-
-namespace Microsoft.Extensions.DependencyInjection;
-
-///
-/// The deferred is injected as a scoped services and
-/// preserves the instance it creates.
-///
-/// This is done so that the executions running on one service scope share the deferred execution
-/// state between each other.
-///
-/// is disposable and will be disposed with the request scope.
-///
-internal sealed class DeferredWorkStateOwnerFactory : IFactory
-{
- private readonly object _sync = new();
- private readonly ObjectPool _pool;
- private DeferredWorkStateOwner? _owner;
-
- public DeferredWorkStateOwnerFactory(ObjectPool pool)
- {
- _pool = pool;
- }
-
- public DeferredWorkStateOwner Create()
- {
- if (_owner is null)
- {
- lock (_sync)
- {
- _owner ??= new DeferredWorkStateOwner(_pool);
- }
- }
-
- return _owner;
- }
-}
diff --git a/src/HotChocolate/Core/src/Execution/HotChocolate.Execution.csproj b/src/HotChocolate/Core/src/Execution/HotChocolate.Execution.csproj
deleted file mode 100644
index a30275088fc..00000000000
--- a/src/HotChocolate/Core/src/Execution/HotChocolate.Execution.csproj
+++ /dev/null
@@ -1,247 +0,0 @@
-
-
-
- true
-
-
-
- HotChocolate.Execution
- HotChocolate.Execution
- HotChocolate.Execution
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
- Resources.resx
-
-
- OperationCompiler.cs
-
-
- OperationCompiler.cs
-
-
- OperationCompiler.cs
-
-
- OperationCompiler.cs
-
-
- OperationContext.cs
-
-
- OperationContext.cs
-
-
- OperationCompiler.cs
-
-
- MiddlewareContext.Global.cs
-
-
- MiddlewareContext.Global.cs
-
-
- MiddlewareContext.Global.cs
-
-
- MiddlewareContext.Global.cs
-
-
- MiddlewareContext.Global.cs
-
-
- ResolverTask.cs
-
-
- WorkScheduler.cs
-
-
- WorkScheduler.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- SchemaRequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- ValueCompletion.cs
-
-
- ValueCompletion.cs
-
-
- ValueCompletion.cs
-
-
- ResultBuilder.cs
-
-
- ResultBuilder.cs
-
-
- ResultBuilder.cs
-
-
- ResolverTask.cs
-
-
- ResolverTask.cs
-
-
- OperationContext.cs
-
-
- OperationContext.cs
-
-
- OperationContext.cs
-
-
- OperationContext.cs
-
-
- JsonResultFormatter.cs
-
-
- SubscriptionExecutor.cs
-
-
- RequestExecutorResolver.cs
-
-
- ValueCompletion.cs
-
-
- BatchExecutor.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorManager.cs
-
-
- RequestExecutorManager.cs
-
-
- RequestExecutorManager.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
- RequestExecutorBuilderExtensions.cs
-
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
-
diff --git a/src/HotChocolate/Core/src/Execution/Processing/DeferredExecutionTask.cs b/src/HotChocolate/Core/src/Execution/Processing/DeferredExecutionTask.cs
deleted file mode 100644
index f4de9856a12..00000000000
--- a/src/HotChocolate/Core/src/Execution/Processing/DeferredExecutionTask.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using System.Collections.Immutable;
-using HotChocolate.Utilities;
-using static HotChocolate.WellKnownContextData;
-
-namespace HotChocolate.Execution.Processing;
-
-///
-/// Represents a deprioritized part of the query that will be executed after
-/// the main execution has finished.
-///
-internal abstract class DeferredExecutionTask
-{
- ///
- /// Initializes a new instance of .
- ///
- protected DeferredExecutionTask(IImmutableDictionary scopedContextData)
- {
- ScopedContextData = scopedContextData;
- }
-
- ///
- /// Gets the preserved scoped context from the parent resolver.
- ///
- public IImmutableDictionary ScopedContextData { get; }
-
- ///
- /// Starts executing the deferred execution task.
- ///
- ///
- /// The operation context owner.
- ///
- ///
- /// The internal result identifier.
- ///
- ///
- /// The internal identifier of the object that the result will be patched into.
- ///
- public void Begin(OperationContextOwner operationContextOwner, uint resultId, uint patchId)
- {
- // retrieve the task on which this task depends upon. We do this to ensure that the result
- // of this task is not delivered before the parent result is delivered.
- uint parentResultId = 0;
- if (ScopedContextData.TryGetValue(DeferredResultId, out var value)
- && value is uint id)
- {
- parentResultId = id;
- }
-
- var capturedContext = ExecutionContext.Capture();
- if (capturedContext is null)
- {
- ExecuteAsync(operationContextOwner, resultId, parentResultId, patchId).FireAndForget();
- }
- else
- {
- var execute = () =>
- ExecutionContext.Run(
- capturedContext,
- _ => ExecuteAsync(operationContextOwner, resultId, parentResultId, patchId),
- null);
- execute.FireAndForget();
- }
- }
-
- ///
- /// The task execution logic.
- ///
- ///
- /// The operation context owner.
- ///
- ///
- /// The internal result identifier.
- ///
- ///
- /// The parent result identifier.
- ///
- ///
- /// The internal identifier of the object that the result will be patched into.
- ///
- protected abstract Task ExecuteAsync(
- OperationContextOwner operationContextOwner,
- uint resultId,
- uint parentResultId,
- uint patchId);
-}
diff --git a/src/HotChocolate/Core/src/Execution/Processing/DeferredExecutionTaskResult.cs b/src/HotChocolate/Core/src/Execution/Processing/DeferredExecutionTaskResult.cs
deleted file mode 100644
index 23fad4d1ea5..00000000000
--- a/src/HotChocolate/Core/src/Execution/Processing/DeferredExecutionTaskResult.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace HotChocolate.Execution.Processing;
-
-internal readonly struct DeferredExecutionTaskResult
-{
- public DeferredExecutionTaskResult(
- uint taskId,
- uint parentTaskId,
- IOperationResult? result = null)
- {
- TaskId = taskId;
- ParentTaskId = parentTaskId;
- Result = result;
- }
-
- public uint TaskId { get; }
-
- public uint ParentTaskId { get; }
-
- public IOperationResult? Result { get; }
-}
diff --git a/src/HotChocolate/Core/src/Execution/Processing/DeferredFragment.cs b/src/HotChocolate/Core/src/Execution/Processing/DeferredFragment.cs
deleted file mode 100644
index 90faf750543..00000000000
--- a/src/HotChocolate/Core/src/Execution/Processing/DeferredFragment.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System.Collections.Immutable;
-using static HotChocolate.Execution.Processing.Tasks.ResolverTaskFactory;
-using static HotChocolate.WellKnownContextData;
-
-namespace HotChocolate.Execution.Processing;
-
-///
-/// Represents a deprioritized fragment of the query that will be executed after
-/// the main execution has finished.
-///
-internal sealed class DeferredFragment : DeferredExecutionTask
-{
- ///
- /// Initializes a new instance of .
- ///
- public DeferredFragment(
- IFragment fragment,
- string? label,
- Path path,
- object? parent,
- IImmutableDictionary scopedContextData)
- : base(scopedContextData)
- {
- Fragment = fragment;
- Label = label;
- Path = path;
- Parent = parent;
- }
-
- ///
- /// Gets the deferred fragment.
- ///
- public IFragment Fragment { get; }
-
- ///
- /// If this argument label has a value other than null, it will be passed
- /// on to the result of this defer directive. This label is intended to
- /// give client applications a way to identify to which fragment a deferred
- /// result belongs to.
- ///
- public string? Label { get; }
-
- ///
- /// Gets the result path into which this deferred fragment shall be patched.
- ///
- public Path Path { get; }
-
- ///
- /// Gets the parent / source value.
- ///
- public object? Parent { get; }
-
- protected override async Task ExecuteAsync(
- OperationContextOwner operationContextOwner,
- uint resultId,
- uint parentResultId,
- uint patchId)
- {
- try
- {
- var operationContext = operationContextOwner.OperationContext;
- var parentResult = operationContext.Result.RentObject(Fragment.SelectionSet.Selections.Count);
-
- parentResult.PatchPath = Path;
-
- EnqueueResolverTasks(
- operationContext,
- Fragment.SelectionSet,
- Parent,
- Path,
- // for the execution of this task we set the deferred task ID so that
- // child deferrals can lookup their dependency to this task.
- ScopedContextData.SetItem(DeferredResultId, resultId),
- parentResult);
-
- // start executing the deferred fragment.
- await operationContext.Scheduler.ExecuteAsync().ConfigureAwait(false);
-
- // we create the result but will not create the final result object yet.
- // We will leave the final creation to the deferred work scheduler so that the
- // has next property can be correctly set.
- var result =
- operationContext
- .SetLabel(Label)
- .SetPath(Path)
- .SetData(parentResult)
- .SetPatchId(patchId)
- .BuildResult();
-
- // complete the task and provide the result
- operationContext.DeferredScheduler.Complete(new(resultId, parentResultId, result));
- }
- finally
- {
- operationContextOwner.Dispose();
- }
- }
-}
diff --git a/src/HotChocolate/Core/src/Execution/Processing/DeferredStream.cs b/src/HotChocolate/Core/src/Execution/Processing/DeferredStream.cs
deleted file mode 100644
index f5d6b220101..00000000000
--- a/src/HotChocolate/Core/src/Execution/Processing/DeferredStream.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-using System.Collections.Immutable;
-using HotChocolate.Execution.Processing.Tasks;
-using static HotChocolate.WellKnownContextData;
-
-namespace HotChocolate.Execution.Processing;
-
-///
-/// Represents the work to executed the deferred elements of a stream.
-///
-internal sealed class DeferredStream : DeferredExecutionTask
-{
- private StreamExecutionTask? _task;
-
- ///
- /// Initializes a new instance of .
- ///
- public DeferredStream(
- ISelection selection,
- string? label,
- Path path,
- object? parent,
- int index,
- IAsyncEnumerator