From 87974e31977bf1cd769e497941380e213814e190 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Kolli Date: Wed, 8 Apr 2026 09:10:08 -0700 Subject: [PATCH 1/5] Excptionless: Adds enabling exception less 404/1002 status code --- Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs b/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs index 5ecae3cb64..a4c89c0281 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs @@ -296,6 +296,7 @@ internal DocumentServiceRequest ToDocumentServiceRequest() serviceRequest.UseStatusCodeForFailures = true; serviceRequest.UseStatusCodeFor429 = true; + serviceRequest.UseStatusCodeFor4041002 = true; serviceRequest.Properties = this.Properties; this.DocumentServiceRequest = serviceRequest; } From 5b2c4b2b1a5625b786d884c771fa8862f3110669 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Kolli Date: Wed, 8 Apr 2026 12:12:56 -0700 Subject: [PATCH 2/5] Test error message fix --- .../Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs index 379de2faba..23636ab684 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs @@ -3401,7 +3401,7 @@ public async Task VerifySessionNotFoundStatistics() } catch (CosmosException cosmosException) { - Assert.IsTrue(cosmosException.Message.Contains("The read session is not available for the input session token."), cosmosException.Message); + Assert.IsTrue(cosmosException.Message.Contains("The read/write session is not available"), cosmosException.Message); string exception = cosmosException.ToString(); Assert.IsTrue(exception.Contains("Point Operation Statistics"), exception); } From ca19c81137653fecc95b4d31bdd52cdf6eef6191 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Kolli Date: Fri, 10 Apr 2026 08:36:55 -0700 Subject: [PATCH 3/5] reverting to master --- .../src/Handler/RequestMessage.cs | 733 +++++++++--------- 1 file changed, 366 insertions(+), 367 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs b/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs index 07c671125f..93b64d42ab 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs @@ -1,317 +1,316 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos -{ - using System; +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System; using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; + using System.Diagnostics; + using System.Globalization; using System.IO; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Common; - using Microsoft.Azure.Cosmos.Tracing; - using Microsoft.Azure.Documents; - - /// - /// Represents a request in the processing pipeline of the Azure Cosmos DB SDK. - /// - /// - /// It is expected that direct property access is used for properties that will be read and used within the Azure Cosmos SDK pipeline, for example . - /// should be used for any other property that needs to be sent to the backend but will not be read nor used within the Azure Cosmos DB SDK pipeline. - /// should be used for HTTP headers that need to be passed down and sent to the backend. - /// - public class RequestMessage : IDisposable - { - /// - /// Create a - /// - public RequestMessage() - { - this.Trace = NoOpTrace.Singleton; - } - - /// - /// Create a - /// - /// The http method - /// The requested URI - public RequestMessage(HttpMethod method, Uri requestUri) - { - this.Method = method; - this.RequestUriString = requestUri?.OriginalString; - this.InternalRequestUri = requestUri; - this.Trace = NoOpTrace.Singleton; - } - - /// - /// Create a - /// - /// The http method - /// The requested URI - /// /// The trace node to append traces to. - internal RequestMessage( - HttpMethod method, - string requestUriString, - ITrace trace) - { - this.Method = method; - this.RequestUriString = requestUriString; - this.Trace = trace ?? throw new ArgumentNullException(nameof(trace)); + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Common; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Documents; + + /// + /// Represents a request in the processing pipeline of the Azure Cosmos DB SDK. + /// + /// + /// It is expected that direct property access is used for properties that will be read and used within the Azure Cosmos SDK pipeline, for example . + /// should be used for any other property that needs to be sent to the backend but will not be read nor used within the Azure Cosmos DB SDK pipeline. + /// should be used for HTTP headers that need to be passed down and sent to the backend. + /// + public class RequestMessage : IDisposable + { + /// + /// Create a + /// + public RequestMessage() + { + this.Trace = NoOpTrace.Singleton; + } + + /// + /// Create a + /// + /// The http method + /// The requested URI + public RequestMessage(HttpMethod method, Uri requestUri) + { + this.Method = method; + this.RequestUriString = requestUri?.OriginalString; + this.InternalRequestUri = requestUri; + this.Trace = NoOpTrace.Singleton; } - /// - /// Create a , used for Clone() method. - /// - /// The http method - /// The requested URI + /// + /// Create a + /// + /// The http method + /// The requested URI + /// /// The trace node to append traces to. + internal RequestMessage( + HttpMethod method, + string requestUriString, + ITrace trace) + { + this.Method = method; + this.RequestUriString = requestUriString; + this.Trace = trace ?? throw new ArgumentNullException(nameof(trace)); + } + + /// + /// Create a , used for Clone() method. + /// + /// The http method + /// The requested URI /// The trace node to append traces to. /// The headers to use. - /// The properties to use. - private RequestMessage( - HttpMethod method, - string requestUriString, + /// The properties to use. + private RequestMessage( + HttpMethod method, + string requestUriString, ITrace trace, Headers headers, - Dictionary properties) - { - this.Method = method; - this.RequestUriString = requestUriString; + Dictionary properties) + { + this.Method = method; + this.RequestUriString = requestUriString; this.Trace = trace ?? throw new ArgumentNullException(nameof(trace)); this.headers = new Lazy(() => headers); - this.properties = new Lazy>(() => properties); - } - - /// - /// Gets the for the current request. - /// - public virtual HttpMethod Method { get; private set; } - - /// - /// Gets the for the current request. - /// - public virtual Uri RequestUri - { - get - { - if (this.InternalRequestUri == null) - { - this.InternalRequestUri = new Uri(this.RequestUriString, UriKind.Relative); - } - - return this.InternalRequestUri; - } - } - - /// - /// Gets the current HTTP headers. - /// - public virtual Headers Headers => this.headers.Value; - - /// - /// Gets or sets the current payload. - /// - public virtual Stream Content - { - get => this.content; - set - { - this.CheckDisposed(); - this.content = value; - } - } - - internal string RequestUriString { get; } - - internal Uri InternalRequestUri { get; private set; } - - internal ITrace Trace { get; set; } - - internal RequestOptions RequestOptions { get; set; } - - internal ResourceType ResourceType { get; set; } - - internal OperationType OperationType { get; set; } - - internal PartitionKeyRangeIdentity PartitionKeyRangeId { get; set; } - - /// - /// Used to override the client default. This is used for scenarios - /// in query where the service interop is not present. - /// - internal bool? UseGatewayMode { get; set; } - - internal DocumentServiceRequest DocumentServiceRequest { get; set; } - - internal Action OnBeforeSendRequestActions { get; set; } - - internal bool IsPropertiesInitialized => this.properties.IsValueCreated; - - /// - /// The partition key range handler is only needed for read feed on partitioned resources - /// where the partition key range needs to be computed. - /// - internal bool IsPartitionKeyRangeHandlerRequired => this.OperationType == OperationType.ReadFeed && - this.ResourceType.IsPartitioned() && this.PartitionKeyRangeId == null && - this.Headers.PartitionKey == null; - - internal string ContainerId { get; set; } - internal string DatabaseId { get; set; } - - /// - /// Request properties Per request context available to handlers. - /// These will not be automatically included into the wire. - /// - public virtual Dictionary Properties => this.properties.Value; - - private readonly Lazy> properties = new Lazy>(RequestMessage.CreateDictionary); - - private readonly Lazy headers = new Lazy(RequestMessage.CreateHeaders); - - private bool disposed; - - private Stream content; - - /// - /// Disposes the current . - /// - public void Dispose() - { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Disposes of the request message content - /// - /// True to dispose content - protected virtual void Dispose(bool disposing) - { - // The reason for this type to implement IDisposable is that it contains instances of types that implement - // IDisposable (content). - if (disposing && !this.disposed) - { - this.disposed = true; - if (this.Content != null) - { - this.Content.Dispose(); - } - } - } - - internal void AddThroughputHeader(int? throughputValue) - { - if (throughputValue.HasValue) - { - this.Headers.OfferThroughput = throughputValue.Value.ToString(CultureInfo.InvariantCulture); - } - } - - internal void AddThroughputPropertiesHeader(ThroughputProperties throughputProperties) - { - if (throughputProperties == null) - { - return; - } - - if (throughputProperties.Throughput.HasValue && - (throughputProperties.AutoscaleMaxThroughput.HasValue || throughputProperties.AutoUpgradeMaxThroughputIncrementPercentage.HasValue)) - { - throw new InvalidOperationException("Autoscale provisioned throughput can not be configured with fixed offer"); - } - - if (throughputProperties.Throughput.HasValue) - { - this.AddThroughputHeader(throughputProperties.Throughput); - } - else if (throughputProperties?.Content?.OfferAutoscaleSettings != null) - { - this.Headers.Add(HttpConstants.HttpHeaders.OfferAutopilotSettings, throughputProperties.Content.OfferAutoscaleSettings.GetJsonString()); - } - } - - internal async Task AssertPartitioningDetailsAsync(CosmosClient client, CancellationToken cancellationToken, ITrace trace) - { - if (this.IsMasterOperation() || DistributedTransactionConstants.IsDistributedTransactionRequest(this.OperationType, this.ResourceType)) - { - return; - } - -#if DEBUG - try - { - CollectionCache collectionCache = await client.DocumentClient.GetCollectionCacheAsync(trace); - ContainerProperties collectionFromCache = - await collectionCache.ResolveCollectionAsync(this.ToDocumentServiceRequest(), cancellationToken, trace); - if (collectionFromCache.PartitionKey?.Paths?.Count > 0) - { - Debug.Assert(this.AssertPartitioningPropertiesAndHeaders()); - } - } - catch (DocumentClientException ex) when (ex.StatusCode == HttpStatusCode.NotFound) - { - // Ignore container non-existence - } -#else - await Task.CompletedTask; -#endif - } - - internal DocumentServiceRequest ToDocumentServiceRequest() - { - if (this.DocumentServiceRequest == null) - { - DocumentServiceRequest serviceRequest; - if ((this.OperationType == OperationType.ReadFeed && this.ResourceType == ResourceType.Database) - || DistributedTransactionConstants.IsDistributedTransactionRequest(this.OperationType, this.ResourceType)) - { - serviceRequest = new DocumentServiceRequest( - operationType: this.OperationType, - resourceIdOrFullName: null, - resourceType: this.ResourceType, - body: this.Content, - headers: this.Headers.CosmosMessageHeaders.INameValueCollection, - isNameBased: false, - authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); - } - else - { - serviceRequest = new DocumentServiceRequest( - this.OperationType, - this.ResourceType, - this.RequestUriString, - this.Content, - AuthorizationTokenType.PrimaryMasterKey, - this.Headers.CosmosMessageHeaders.INameValueCollection); - } - - if (this.UseGatewayMode.HasValue) - { - serviceRequest.UseGatewayMode = this.UseGatewayMode.Value; - } - - serviceRequest.UseStatusCodeForFailures = true; - serviceRequest.UseStatusCodeFor429 = true; + this.properties = new Lazy>(() => properties); + } + + /// + /// Gets the for the current request. + /// + public virtual HttpMethod Method { get; private set; } + + /// + /// Gets the for the current request. + /// + public virtual Uri RequestUri + { + get + { + if (this.InternalRequestUri == null) + { + this.InternalRequestUri = new Uri(this.RequestUriString, UriKind.Relative); + } + + return this.InternalRequestUri; + } + } + + /// + /// Gets the current HTTP headers. + /// + public virtual Headers Headers => this.headers.Value; + + /// + /// Gets or sets the current payload. + /// + public virtual Stream Content + { + get => this.content; + set + { + this.CheckDisposed(); + this.content = value; + } + } + + internal string RequestUriString { get; } + + internal Uri InternalRequestUri { get; private set; } + + internal ITrace Trace { get; set; } + + internal RequestOptions RequestOptions { get; set; } + + internal ResourceType ResourceType { get; set; } + + internal OperationType OperationType { get; set; } + + internal PartitionKeyRangeIdentity PartitionKeyRangeId { get; set; } + + /// + /// Used to override the client default. This is used for scenarios + /// in query where the service interop is not present. + /// + internal bool? UseGatewayMode { get; set; } + + internal DocumentServiceRequest DocumentServiceRequest { get; set; } + + internal Action OnBeforeSendRequestActions { get; set; } + + internal bool IsPropertiesInitialized => this.properties.IsValueCreated; + + /// + /// The partition key range handler is only needed for read feed on partitioned resources + /// where the partition key range needs to be computed. + /// + internal bool IsPartitionKeyRangeHandlerRequired => this.OperationType == OperationType.ReadFeed && + this.ResourceType.IsPartitioned() && this.PartitionKeyRangeId == null && + this.Headers.PartitionKey == null; + + internal string ContainerId { get; set; } + internal string DatabaseId { get; set; } + + /// + /// Request properties Per request context available to handlers. + /// These will not be automatically included into the wire. + /// + public virtual Dictionary Properties => this.properties.Value; + + private readonly Lazy> properties = new Lazy>(RequestMessage.CreateDictionary); + + private readonly Lazy headers = new Lazy(RequestMessage.CreateHeaders); + + private bool disposed; + + private Stream content; + + /// + /// Disposes the current . + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Disposes of the request message content + /// + /// True to dispose content + protected virtual void Dispose(bool disposing) + { + // The reason for this type to implement IDisposable is that it contains instances of types that implement + // IDisposable (content). + if (disposing && !this.disposed) + { + this.disposed = true; + if (this.Content != null) + { + this.Content.Dispose(); + } + } + } + + internal void AddThroughputHeader(int? throughputValue) + { + if (throughputValue.HasValue) + { + this.Headers.OfferThroughput = throughputValue.Value.ToString(CultureInfo.InvariantCulture); + } + } + + internal void AddThroughputPropertiesHeader(ThroughputProperties throughputProperties) + { + if (throughputProperties == null) + { + return; + } + + if (throughputProperties.Throughput.HasValue && + (throughputProperties.AutoscaleMaxThroughput.HasValue || throughputProperties.AutoUpgradeMaxThroughputIncrementPercentage.HasValue)) + { + throw new InvalidOperationException("Autoscale provisioned throughput can not be configured with fixed offer"); + } + + if (throughputProperties.Throughput.HasValue) + { + this.AddThroughputHeader(throughputProperties.Throughput); + } + else if (throughputProperties?.Content?.OfferAutoscaleSettings != null) + { + this.Headers.Add(HttpConstants.HttpHeaders.OfferAutopilotSettings, throughputProperties.Content.OfferAutoscaleSettings.GetJsonString()); + } + } + + internal async Task AssertPartitioningDetailsAsync(CosmosClient client, CancellationToken cancellationToken, ITrace trace) + { + if (this.IsMasterOperation() || DistributedTransactionConstants.IsDistributedTransactionRequest(this.OperationType, this.ResourceType)) + { + return; + } + +#if DEBUG + try + { + CollectionCache collectionCache = await client.DocumentClient.GetCollectionCacheAsync(trace); + ContainerProperties collectionFromCache = + await collectionCache.ResolveCollectionAsync(this.ToDocumentServiceRequest(), cancellationToken, trace); + if (collectionFromCache.PartitionKey?.Paths?.Count > 0) + { + Debug.Assert(this.AssertPartitioningPropertiesAndHeaders()); + } + } + catch (DocumentClientException ex) when (ex.StatusCode == HttpStatusCode.NotFound) + { + // Ignore container non-existence + } +#else + await Task.CompletedTask; +#endif + } + + internal DocumentServiceRequest ToDocumentServiceRequest() + { + if (this.DocumentServiceRequest == null) + { + DocumentServiceRequest serviceRequest; + if ((this.OperationType == OperationType.ReadFeed && this.ResourceType == ResourceType.Database) + || DistributedTransactionConstants.IsDistributedTransactionRequest(this.OperationType, this.ResourceType)) + { + serviceRequest = new DocumentServiceRequest( + operationType: this.OperationType, + resourceIdOrFullName: null, + resourceType: this.ResourceType, + body: this.Content, + headers: this.Headers.CosmosMessageHeaders.INameValueCollection, + isNameBased: false, + authorizationTokenType: AuthorizationTokenType.PrimaryMasterKey); + } + else + { + serviceRequest = new DocumentServiceRequest( + this.OperationType, + this.ResourceType, + this.RequestUriString, + this.Content, + AuthorizationTokenType.PrimaryMasterKey, + this.Headers.CosmosMessageHeaders.INameValueCollection); + } + + if (this.UseGatewayMode.HasValue) + { + serviceRequest.UseGatewayMode = this.UseGatewayMode.Value; + } + + serviceRequest.UseStatusCodeForFailures = true; + serviceRequest.UseStatusCodeFor429 = true; serviceRequest.UseStatusCodeFor403 = true; serviceRequest.UseStatusCodeForBadRequest = true; - serviceRequest.UseStatusCodeFor4041002 = true; - serviceRequest.Properties = this.Properties; - this.DocumentServiceRequest = serviceRequest; - } - - // Routing to a particular PartitionKeyRangeId - if (this.PartitionKeyRangeId != null) - { - this.DocumentServiceRequest.RouteTo(this.PartitionKeyRangeId); - } - - this.DocumentServiceRequest.RequestContext.ExcludeRegions = this.RequestOptions?.ExcludeRegions; - this.OnBeforeRequestHandler(this.DocumentServiceRequest); - return this.DocumentServiceRequest; + serviceRequest.Properties = this.Properties; + this.DocumentServiceRequest = serviceRequest; + } + + // Routing to a particular PartitionKeyRangeId + if (this.PartitionKeyRangeId != null) + { + this.DocumentServiceRequest.RouteTo(this.PartitionKeyRangeId); + } + + this.DocumentServiceRequest.RequestContext.ExcludeRegions = this.RequestOptions?.ExcludeRegions; + this.OnBeforeRequestHandler(this.DocumentServiceRequest); + return this.DocumentServiceRequest; } /// @@ -353,73 +352,73 @@ internal RequestMessage Clone(ITrace newTrace, CloneableStream cloneContent) clone.DatabaseId = this.DatabaseId; return clone; - } - - private static Dictionary CreateDictionary() - { - return new Dictionary(); - } - - private static Headers CreateHeaders() - { - return new Headers(); - } - - private void OnBeforeRequestHandler(DocumentServiceRequest serviceRequest) - { - serviceRequest.RequestContext.ExcludeRegions = this.RequestOptions?.ExcludeRegions; - this.OnBeforeSendRequestActions?.Invoke(serviceRequest); - } - - private bool AssertPartitioningPropertiesAndHeaders() - { - // Either PK/key-range-id is assumed - bool pkExists = !string.IsNullOrEmpty(this.Headers.PartitionKey); - bool epkExists = this.Properties.ContainsKey(WFConstants.BackendHeaders.EffectivePartitionKeyString); - if (pkExists && epkExists) - { - throw new ArgumentNullException(RMResources.PartitionKeyAndEffectivePartitionKeyBothSpecified); - } - - bool isPointOperation = this.OperationType != OperationType.ReadFeed; - if (!pkExists && !epkExists && this.OperationType.IsPointOperation()) - { - throw new ArgumentNullException(RMResources.MissingPartitionKeyValue); - } - - bool partitionKeyRangeIdExists = !string.IsNullOrEmpty(this.Headers.PartitionKeyRangeId); - if (partitionKeyRangeIdExists) + } + + private static Dictionary CreateDictionary() + { + return new Dictionary(); + } + + private static Headers CreateHeaders() + { + return new Headers(); + } + + private void OnBeforeRequestHandler(DocumentServiceRequest serviceRequest) + { + serviceRequest.RequestContext.ExcludeRegions = this.RequestOptions?.ExcludeRegions; + this.OnBeforeSendRequestActions?.Invoke(serviceRequest); + } + + private bool AssertPartitioningPropertiesAndHeaders() + { + // Either PK/key-range-id is assumed + bool pkExists = !string.IsNullOrEmpty(this.Headers.PartitionKey); + bool epkExists = this.Properties.ContainsKey(WFConstants.BackendHeaders.EffectivePartitionKeyString); + if (pkExists && epkExists) + { + throw new ArgumentNullException(RMResources.PartitionKeyAndEffectivePartitionKeyBothSpecified); + } + + bool isPointOperation = this.OperationType != OperationType.ReadFeed; + if (!pkExists && !epkExists && this.OperationType.IsPointOperation()) { - OperationType operationType = this.OperationType; - // Assert operation type is not write + throw new ArgumentNullException(RMResources.MissingPartitionKeyValue); + } + + bool partitionKeyRangeIdExists = !string.IsNullOrEmpty(this.Headers.PartitionKeyRangeId); + if (partitionKeyRangeIdExists) + { + OperationType operationType = this.OperationType; + // Assert operation type is not write if (operationType != OperationType.Query && operationType != OperationType.QueryPlan && operationType != OperationType.ReadFeed - && operationType != OperationType.Batch) - { - throw new ArgumentOutOfRangeException(RMResources.UnexpectedPartitionKeyRangeId); - } - } - - if (pkExists && partitionKeyRangeIdExists) - { - throw new ArgumentOutOfRangeException(RMResources.PartitionKeyAndPartitionKeyRangeRangeIdBothSpecified); - } - - return true; - } - - private bool IsMasterOperation() - { - return this.ResourceType != ResourceType.Document; - } - - private void CheckDisposed() - { - if (this.disposed) - { - throw new ObjectDisposedException(this.GetType().ToString()); - } - } - } + && operationType != OperationType.Batch) + { + throw new ArgumentOutOfRangeException(RMResources.UnexpectedPartitionKeyRangeId); + } + } + + if (pkExists && partitionKeyRangeIdExists) + { + throw new ArgumentOutOfRangeException(RMResources.PartitionKeyAndPartitionKeyRangeRangeIdBothSpecified); + } + + return true; + } + + private bool IsMasterOperation() + { + return this.ResourceType != ResourceType.Document; + } + + private void CheckDisposed() + { + if (this.disposed) + { + throw new ObjectDisposedException(this.GetType().ToString()); + } + } + } } \ No newline at end of file From 2d17bbd9fedf5973aadb922c1755952125121566 Mon Sep 17 00:00:00 2001 From: Kiran Kumar Kolli Date: Fri, 10 Apr 2026 08:37:50 -0700 Subject: [PATCH 4/5] Using exceptionless for 404/102 --- Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs b/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs index 93b64d42ab..6dc286114b 100644 --- a/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs +++ b/Microsoft.Azure.Cosmos/src/Handler/RequestMessage.cs @@ -298,6 +298,7 @@ internal DocumentServiceRequest ToDocumentServiceRequest() serviceRequest.UseStatusCodeFor429 = true; serviceRequest.UseStatusCodeFor403 = true; serviceRequest.UseStatusCodeForBadRequest = true; + serviceRequest.UseStatusCodeFor4041002 = true; serviceRequest.Properties = this.Properties; this.DocumentServiceRequest = serviceRequest; } From aaa87d06aba4b75c2c5391fcbbcf6303a22405ad Mon Sep 17 00:00:00 2001 From: Kiran Kumar Kolli Date: Fri, 10 Apr 2026 12:17:54 -0700 Subject: [PATCH 5/5] Removing the point opeation statistics expectation --- .../Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs index 23636ab684..e9971c550b 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs @@ -3402,8 +3402,6 @@ public async Task VerifySessionNotFoundStatistics() catch (CosmosException cosmosException) { Assert.IsTrue(cosmosException.Message.Contains("The read/write session is not available"), cosmosException.Message); - string exception = cosmosException.ToString(); - Assert.IsTrue(exception.Contains("Point Operation Statistics"), exception); } } finally