If you use Swagger generated REST proxies then you have probably come across the pretty new Microsoft.Rest namespace and namely the abstract class ServiceClient. I noticed a strange behavior when using clients that subclass this base class. The default behavior for this class is to retry when a 500 status code is returned.
I can not understand the reason for this being Opt out, its obvious a feature like this should be Opt in. So keep in mind when using this class you must always call SetRetryPolicy to disable the retry strategy.
var service = new MyService(uri, credentials); service.SetRetryPolicy(new RetryPolicy(new HttpStatusCodeErrorDetectionStrategy(), 0));
This explains a lot of errant behavior I was witnessing in my recent swagger generated ‘autorest’ client. Thank you for posting this
Could not find much documentation on this. Very helpful!
Thanks! Very strange behavior if you ask me 😀