I have the following code that shows a File Picker in an application:
var FilePicker = new Windows.Storage.Pickers.FileOpenPicker();
FilePicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
FilePicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.ComputerFolder;
Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync();
Windows.Storage.StorageFile File = await FilePicker.PickSingleFileAsync()
Error CS4036 'IAsyncOperation<StorageFile>' does not contain a
definition for 'GetAwaiter' and no extension method 'GetAwaiter'
accepting a first argument of type 'IAsyncOperation<StorageFile>'
could be found (are you missing a using directive for 'System'?)
You are missing the obvious reference to
System in your usings.
Why do you need this reference and why it complains it is missing a seemingly unused method?
await, it actually calls
WindowsRuntimeSystemExtensions.GetAwaiter, an extension method over
IAsyncOperation (to get the
TaskAwaiter to await). Since
WindowsRuntimeSystemExtensions resides in the
System namespace, you need that
using to get the extension method.