From 203f841da54d73a989efd84677e0f0b1d3c2acbf Mon Sep 17 00:00:00 2001 From: Emilien Bevierre Date: Tue, 19 May 2026 17:42:10 +0100 Subject: [PATCH] Fix ContentAs error --- .../Internal/Utils/PerformerQuery.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fit/Couchbase.Analytics.Performer/Internal/Utils/PerformerQuery.cs b/fit/Couchbase.Analytics.Performer/Internal/Utils/PerformerQuery.cs index 787cc2e..c6bb36c 100644 --- a/fit/Couchbase.Analytics.Performer/Internal/Utils/PerformerQuery.cs +++ b/fit/Couchbase.Analytics.Performer/Internal/Utils/PerformerQuery.cs @@ -64,21 +64,23 @@ public async Task GetNextRow(ContentAs? rowContentAs = null) } } - var effectiveContentAs = rowContentAs ?? ContentAs - ?? throw new InvalidOperationException("No ContentAs available for row deserialization."); + var effectiveContentAs = rowContentAs ?? ContentAs; QueryRowResponse response; if (await _cachedEnumerator!.MoveNextAsync().ConfigureAwait(false)) { + var row = new QueryRowResponse.Types.Row(); + // QueryRowResponse.Row is optional and only present if the driver sent ContentAs in the request + if (effectiveContentAs is not null) + { + row.RowContent = _cachedEnumerator.Current.ContentAsToAnalyticsRow(effectiveContentAs); + } response = new QueryRowResponse() { Success = new QueryRowResponse.Types.Result() { - Row = new QueryRowResponse.Types.Row() - { - RowContent = _cachedEnumerator.Current.ContentAsToAnalyticsRow(effectiveContentAs) - } + Row = row } }; } @@ -95,4 +97,4 @@ public async Task GetNextRow(ContentAs? rowContentAs = null) return response; } -} +} \ No newline at end of file