Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'TimeLimiter' does not contain a definition for 'GetAwaiter' #30

Open
KoalaBear84 opened this issue May 28, 2021 · 2 comments
Open

'TimeLimiter' does not contain a definition for 'GetAwaiter' #30

KoalaBear84 opened this issue May 28, 2021 · 2 comments

Comments

@KoalaBear84
Copy link

Was trying RateLimiter, but can't get it to work like showed in the Readme / Documentation.

Error CS1061 'TimeLimiter' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'TimeLimiter' could be found (are you missing a using directive or an assembly reference?)

Tried with .NET Framework 4.7.2 and .NET 5.

Is the code changed lately?
 
image

Code:

using RateLimiter;
using System;
using System.Threading.Tasks;

namespace RateLimiterTest
{
    class Program
    {
        private static readonly TimeLimiter TimeLimiterTest = TimeLimiter.GetFromMaxCountByInterval(20, TimeSpan.FromMinutes(1));

        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            await TimeLimiterTest;

            Console.WriteLine("Finished!");
        }
    }
}

Also it would be nice to use an interval of 5 seconds so you can better see the time differences.

@fretje
Copy link

fretje commented Sep 16, 2021

I have the same problem... did you get any further with this?

@fretje
Copy link

fretje commented Sep 16, 2021

Ok, I found it. Apparently you need a

using ComposableAsync;

at the top. GetAwaiter is implemented there as an extension method on IDispatcher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants