Closed steevehuin closed 3 years ago
hi @steevehuin you would have to use the await
inside of an async
method.
If you didn't want to do that, you could just call .Result
where it would block until the task is completed as such:
var allAccounts = coinbaseProClient.AccountsService.GetAllAccountsAsync().Result;
or you could even mark your main method async
and do something like this:
public static async Task Main(string[] args)
{
.....
var allAccounts = await coinbaseProClient.AccountsService.GetAllAccountsAsync();
}
i'd recommend reading some more on the topic here: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/
Hi there,
I'm new to this project and have successfully downloaded/compiled the CoinbasePro project; and have tried to follow a simple example:
` //create an authenticator with your apiKey, apiSecret and passphrase var authenticator = new Authenticator("...", "...", "...");
`
For some reasons, Visual Studio 2019 is failing at compile indicating that it's not possible to use await on the GetAllAccountsAsync() call. Any reasons why that's the case?
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. CoinbaseAutomate C:\Users\steeve.huin\OneDrive - Irdeto B.V\Documents\Development\coinbasepro-csharp-master\CoinbaseAutomate\Program.cs 41 Active
Thanks Steeve