Fixing "Element not found. (Exception from HRESULT: 0x80070490)" error in Windows 8.x

Recently encountered this issue on a Unity 4.3b4 project targeting Windows 8.1 SDK, however it was running fine targeting 8.0 SDK. I was trying to save a screenshot from the app, the app has a callback to the C# function below:

private static async void saveImageAsync(byte[] pngData) {      Exception ex;      try      {                 FileSavePicker picker = new FileSavePicker();                 picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;                 picker.FileTypeChoices.Add("Suggested File Type", new List() {".png"});                 StorageFile file = await picker.PickSaveFileAsync();                   if (file != null)                 {                   ...

The project had access to picturesLibrary, webcam and microphone. When it got to the “FileSavePicker picker = new FileSavePicker();”, it was giving an exception of “Element not found. (Exception from HRESULT: 0x80070490)”.
I found that it wasn’t running on the UI thread, which is why it is not finding the save file picker. The fix was to use a dispatcher to a UI thread. If you surround the above code with dispatcher below, it will run on the UI thread.
``

await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>; { // code that goes to UI thread }