ArgumentException in DiagnosticsHandler with external retry mechanism
See original GitHub issueDescribe the bug I use Polly as a retry mechanism and use the CircuitBreaker to wrap call to CosmosDb. When a request is retried, I got an ArgumentException in the DiagnosticsHandler. It try to add again a “System Info” key in the request’s trace.
Expected behavior Do not throw exception, replace the item in the dictionary.
Actual behavior Code throw an ArgumentException.
Environment summary SDK Version: 3.29.0 OS Version: Linux
Additional context
System.ArgumentException:
at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Collections.Generic.Dictionary`2.TryInsert (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.Cosmos.Tracing.Trace.AddDatum (Microsoft.Azure.Cosmos.Client, Version=3.28.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler+<SendAsync>d__0.MoveNext (Microsoft.Azure.Cosmos.Client, Version=3.28.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
HttpClient retry logic not working as expected (.Net Core 3.1)
This corresponds to a class I have which makes calls to an external service however it is not retrying upon failure. I have...
Read more >Polly is a .NET resilience and transient-fault-handling ...
NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, ...
Read more >Retry guidance for Azure services
Learn about the retry mechanism features for many Azure services. Retry mechanisms differ because services have different characteristics ...
Read more >Working with Polly – Using the Context to Obtain the Retry ...
In this post, we'll explore a use for the Polly Context object to share data between our code and the execution of a...
Read more >c# - 'Retry' mechanism with callback
We've had a situation whereby we have to cater for certain exceptions and retry a particular method whenever these exceptions occur. This is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, I missed that sample. Thank you to answer so fast !
Did using
base.SendAsync
fix the error you were seeing?