Skip to content

Repository files navigation

Flurl Test for sync and async on old version and new version


we use .net framework 4.6.2 with flurl 2.4.2 and 4.0.2


Flurl 2.4.2

Async

flurl

Async with ConfigureAwait(false)

flurl

Sync

flurl

Sync with ConfigureAwait(false)

flurl


Flurl 4.0.2

Async

flurl

Async with ConfigureAwait(false)

flurl

Sync

flurl

Sync with ConfigureAwait(false)

flurl


Result

On both new and old version if we use sync like bellow code we get time out.
Also WithTimeout not work on this code

return _baseHttpAddress
        .WithHeaders(headers)
        .WithTimeout(TimeSpan.FromSeconds(TimeOutOnSecond))
        .AppendPathSegment(url)
        .SetQueryParams(query)
        .GetJsonAsync<TResponse>()
        .GetAwaiter().GetResult();

If add ConfigureAwait(false) problem will be solved on low concurrency.
If we increase threads more than 100, we get errors again.

return _baseHttpAddress
        .WithHeaders(headers)
        .WithTimeout(TimeSpan.FromSeconds(TimeOutOnSecond))
        .AppendPathSegment(url)
        .SetQueryParams(query)
        .GetJsonAsync<TResponse>()
        .ConfigureAwait(false).GetAwaiter().GetResult();

This problem happened only on first call, for example if call sync and wait to complete and then again call sync, we don't get any errors

About

FlurlTest for sync and async on old version and new version

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages