how to make sure await is completed


i am new to xamarin. i wrote an async method which call web service that contains users list. i am using Telerik Autocomplete to populate users.

As this is async , results are not fully populated in the control. So , how can i ensure that the await is completed?

Please suggest me

private async void LoadData()

            userStates = new ObservableCollection<User>(await appService.GetAllUsers());

            if (userStates != null)
                autoComplete.ItemsSource = userStates;
                autoComplete.TextSearchPath = "FirstName";


        catch (Exception ex)
            await DisplayAlert("Error", ex.Message, "ok");


  • CharwakaCharwaka INMember ✭✭✭✭✭
    edited November 2017

    Hi @vinay_inavolu

    Wherever you calling **LoadData()
    call like this

    await LoadData();


    if you can await use like this

      Task.Run(async () =>
                                await LoadData();

    don't forget to mark as answer if this works for you

  • vinay_inavoluvinay_inavolu SGUniversity ✭✭

    Hi Charwaka

    Thanks for the update. i tried this, but still no luck on telerik Autocomplete filtering. Not sure if its issue from Telerik. Posted a query now to them. Will update you on this.

    Thanks for your time.


Sign In or Register to comment.