DEV Community

Discussion on: Async/Await easy retry in c#

Collapse
 
ilmtitan profile image
Jim Przybylinski

I don't think this library does what you think it does. Awaiting a task a second time does not restart the operation. For it to work, this test code will needs to pass:

        [Test]
        public async Task TestFailThenSucceed()
        {
            int iteration = 1;
            await Task.Run(() =>
            {
                if (iteration++ == 1)
                {
                    throw new Exception();
                }
            }).Retry();
        }

It does not pass, and neither does the unit test you wrote.

Collapse
 
alialp profile image
Ali Alp

You are right :) , I have fixed the code and released as version 2.0.0. your test has been included in the project as well :) github.com/alicommit-malp/Easy-Ret...