C#: Linked by the great Raymond Chen
So I won an Oscar too :) and was honored with a link from Raymond Chen. Sometime back I posted on including try/catch/retry block in C# and he is recommending not using such automatic retrying. However, I do not agree with the flat recommendation and I think this varies based on the scenario.
This is what I replied to his post....
I agree that just retrying does not work in all situation. In https://blogs.msdn.com/abhinaba/archive/2005/10/01/476026.aspx
the example I used does not arbitrarily retry the operation 3 times. It uses an Exception class which explicitly uses a public member to signal whether the operation is retryable.
In all situations asking the user for retrying does not work. Lets take the example of one of the source code repository converters we are working on. This takes a VSS repository and migrates all data in it to Team Foundation Server repository. This includes thousands of files and hundreds of versions of each of them amounting to 10s of GB of data and takes a day to migrate. In this super-high stress situation VSS server sometimes acts-up and either times-out or throws an error. So what do we do, expect the user to sit around for the whole day and see each failure and prompt him Retry (Y/N)? or fail the migration that was going on for the last 8 hours?
My point is in some situations like an interactive program (UI client) prompting the user for retry is the correct thing to do. In long running un-attended batch conversion job where we know for sure that transient failures occur and get resolved on retrying, using retry is the right approach.