1

I am using hellosign c# api and when I am calling function for account info using below code

var helloSign = new HelloSignClient("username", "password");
    Account account = await helloSign.Account.GetAsync();
    Console.WriteLine("Your current callback: " + account.CallbackUrl);

I am getting below error.

Error    2    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'.

below is GetAsync method

public async Task<Account> GetAsync()
        {
            AccountWrapper accountWrapper = await helloSignService.MakeRequestAsync<AccountWrapper>(settings.HelloSignSettings.Endpoints.Account.Get);
            return accountWrapper.Account;
        }

this is type of account class

public class Account : AccountCondensedWithRole
    {
        [JsonProperty("callback_url")]
        public string CallbackUrl { get; internal set; }
    }

Can some one tell me how to call this or how to debug this ???

3
  • did that signature change recently - could you try a clean build? Commented May 30, 2015 at 23:32
  • @DanielA.White i already did rebuilt.. but not working ... so i thought of posting it .. Commented May 30, 2015 at 23:34
  • @DanielA.White what does signature change recently means ...??? Commented May 30, 2015 at 23:34

3 Answers 3

3

you should wrap this block in Async Method like this

public async Task<Type> MethodAsync(){
    // other code if needed ....
    var helloSign = new HelloSignClient("username", "password");
    Account account = await helloSign.Account.GetAsync();
    Console.WriteLine("Your current callback: " + account.CallbackUrl);
    return type;

}
Sign up to request clarification or add additional context in comments.

1 Comment

How should I call inside main method, if I want to some return type.. How can i do that can u please explain it to me ??
3

The message is pretty clear. This line must be inside a method marked with async:

Account account = await helloSign.Account.GetAsync();

Comments

2

You can only use await in an async method.

Here's another question to the same problem await operator

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.