locked
'await' requires that the type 'Windows.Foundation.IAsyncAction' have a suitable GetAwaiter method. Are you missing a using directive for 'System'?

    Question

  • Hi,

    How to fix this?

    Error 2 'await' requires that the type 'Windows.Foundation.IAsyncAction' have a suitable GetAwaiter method. Are you missing a using directive for 'System'? C:\_Repository\Multisite Video Player\Multisite Video Player\Multisite Video Player\ViewModels\ProjectionViewPageViewModel.cs 47 13 Multisite Video Player

    /// <summary> /// The evnet is publishing from PreferencePage /// </summary> /// <param name="obj"></param> private async void OnUpdateURLChangedExecute(string obj) { var x = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().CoreWindow.Dispatcher; await x.RunAsync(CoreDispatcherPriority.Normal, () => { this.OnPropertyChanged("MediaFilePath"); }); }

    This code works fine with codebehide but not for ViewModel

    Sunday, September 28, 2014 6:12 AM

Answers

  • Hi, Mr.Weera PongPruchya.

    You must add "using System;" for usings of your viewModel, because VS doesn't see any async/await if you don't include "System" for your usings.

    Regards, Nikita.

    Sunday, September 28, 2014 7:02 AM