Skip to content

Implement fix for LINQ Take() modifying original QueryRequestOptions

ee22bfd
Select commit
Loading
Failed to load commit list.
Draft

Fix LINQ Take() silently modifying cached QueryRequestOptions objects #5292

Implement fix for LINQ Take() modifying original QueryRequestOptions
ee22bfd
Select commit
Loading
Failed to load commit list.
Azure Pipelines / dotnet-v3-ci failed Jul 16, 2025 in 1h 37m 6s

Build #20250716.6 had test failures

Details

Tests

  • Failed: 25 (0.29%)
  • Passed: 8,621 (98.51%)
  • Other: 105 (1.20%)
  • Total: 8,751
Code coverage

  • 53151 of 95586 line covered (55.61%)

Annotations

Check failure on line 2126 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Build log #L2126

Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

Check failure on line 2131 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Build log #L2131

Dotnet command failed with non-zero exit code on the following projects : [
  'D:\\a\\_work\\1\\s\\Microsoft.Azure.Cosmos\\tests\\Microsoft.Azure.Cosmos.EmulatorTests\\Microsoft.Azure.Cosmos.EmulatorTests.csproj'
]

Check failure on line 2956 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Build log #L2956

Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1

Check failure on line 2961 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Build log #L2961

Dotnet command failed with non-zero exit code on the following projects : [
  'D:\\a\\_work\\1\\s\\Microsoft.Azure.Cosmos\\tests\\Microsoft.Azure.Cosmos.EmulatorTests\\Microsoft.Azure.Cosmos.EmulatorTests.csproj'
]

Check failure on line 1 in Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.AllTests

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.AllTests

Assert.IsTrue failed. Max Item Count is not being honored. Got 350 documents when the max is -1.
Raw output
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.QueryWithoutContinuationTokensAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 679
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.RunQueryCombinationsAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions, QueryDrainingMode queryDrainingMode) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 0
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.OrderByTests(Container container) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\CosmosUndefinedQueryTests.cs:line 227
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.RunTests(Container container, IReadOnlyList`1 _) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\CosmosUndefinedQueryTests.cs:line 67
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.CreateIngestQueryDeleteAsync[T](ConnectionModes connectionModes, CollectionTypes collectionTypes, IEnumerable`1 documents, Query`1 query, CosmosClientFactory cosmosClientFactory, T testArgs, String partitionKey, IndexingPolicy indexingPolicy, GeospatialType geospatialType, VectorEmbeddingPolicy vectorEmbeddingPolicy) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 537
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.AllTests() in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\CosmosUndefinedQueryTests.cs:line 45
   at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)

Check failure on line 1 in Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.HybridSearchTests

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.HybridSearchTests

Assert.IsTrue failed. Max Item Count is not being honored. Got 0 documents when the max is -1.
Raw output
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.QueryWithoutContinuationTokensAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 679
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.RunQueryCombinationsAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions, QueryDrainingMode queryDrainingMode) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 0
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.RunUndefinedProjectionTests(Container container, IEnumerable`1 testCases) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\CosmosUndefinedQueryTests.cs:line 199
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.HybridSearchTests(Container container, IReadOnlyList`1 _) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\CosmosUndefinedQueryTests.cs:line 118
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.CreateIngestQueryDeleteAsync[T](ConnectionModes connectionModes, CollectionTypes collectionTypes, IEnumerable`1 documents, Query`1 query, CosmosClientFactory cosmosClientFactory, T testArgs, String partitionKey, IndexingPolicy indexingPolicy, GeospatialType geospatialType, VectorEmbeddingPolicy vectorEmbeddingPolicy) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 537
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.CosmosUndefinedQueryTests.HybridSearchTests() in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\CosmosUndefinedQueryTests.cs:line 57
   at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)

Check failure on line 1 in Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestPassingOptimisticDirectExecutionQueries

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestPassingOptimisticDirectExecutionQueries

Assert.IsTrue failed. Max Item Count is not being honored. Got 5 documents when the max is -1.
Raw output
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.QueryWithoutContinuationTokensAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 679
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.RunQueryCombinationsAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions, QueryDrainingMode queryDrainingMode) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 0
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.RunTests(IEnumerable`1 testCases, Container container, QueryDrainingMode queryDrainingMode) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\OptimisticDirectExecutionQueryTests.cs:line 884
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.CreateIngestQueryDeleteAsync[T](ConnectionModes connectionModes, CollectionTypes collectionTypes, IEnumerable`1 documents, Query`1 query, CosmosClientFactory cosmosClientFactory, T testArgs, String partitionKey, IndexingPolicy indexingPolicy, GeospatialType geospatialType, VectorEmbeddingPolicy vectorEmbeddingPolicy) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 537
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestPassingOptimisticDirectExecutionQueries() in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\OptimisticDirectExecutionQueryTests.cs:line 427

Check failure on line 1 in Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestOdeEnvironmentVariable

See this annotation in the file changed.

@azure-pipelines azure-pipelines / dotnet-v3-ci

Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestOdeEnvironmentVariable

Assert.IsTrue failed. Max Item Count is not being honored. Got 5 documents when the max is -1.
Raw output
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.QueryWithoutContinuationTokensAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 679
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.RunQueryCombinationsAsync[T](Container container, String query, QueryRequestOptions queryRequestOptions, QueryDrainingMode queryDrainingMode) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 0
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.RunTests(IEnumerable`1 testCases, Container container, QueryDrainingMode queryDrainingMode) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\OptimisticDirectExecutionQueryTests.cs:line 884
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.QueryTestsBase.CreateIngestQueryDeleteAsync[T](ConnectionModes connectionModes, CollectionTypes collectionTypes, IEnumerable`1 documents, Query`1 query, CosmosClientFactory cosmosClientFactory, T testArgs, String partitionKey, IndexingPolicy indexingPolicy, GeospatialType geospatialType, VectorEmbeddingPolicy vectorEmbeddingPolicy) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\QueryTestsBase.cs:line 537
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestQueryExecutionUsingODEEnvironmentVariable(String environmentVariableValue, Boolean expectODEPipeline) in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\OptimisticDirectExecutionQueryTests.cs:line 851
   at Microsoft.Azure.Cosmos.EmulatorTests.Query.OptimisticDirectExecutionQueryTests.TestOdeEnvironmentVariable() in D:\a\_work\1\s\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Query\OptimisticDirectExecutionQueryTests.cs:line 803