Windows Phone 10 File Save Picker Not Working

353 views Asked by At

I'm having trouble getting the "file save picker" contract working in Windows Phone 10 for my Universal Windows App. I've added both "File Save Picker" and "Cached File Updater" declarations to the app manifest.

It works fine for me on a full Windows 10 computer (tested Mail and Mobile Word).

When I try it on a phone running WP10, I get a native exception A heap has been corrupted (parameters: 0x77344270) with error code 0xc0000374. No part of the stacktrace leads into my app.

My TargetFileRequested listener:

    private async void FileSavePickerUI_TargetFileRequested(
        FileSavePickerUI sender,
        TargetFileRequestedEventArgs args)
    {
        var deferral = args.Request.GetDeferral();
        var filePath = GetSelectedFilePath();

        args.Request.TargetFile = await StorageFile.GetFileFromPathAsync(filePath);

        CachedFileUpdater.SetUpdateInformation(
            args.Request.TargetFile,
            CachedFileListener.CreateContentId(contentId, destination),
            ReadActivationMode.NotNeeded,
            WriteActivationMode.AfterWrite,
            CachedFileOptions.None);

        deferral.Complete();
    }

I'm overriding OnCachedFileUpdaterActivated(CachedFileUpdaterActivatedEventArgs args), but it never gets called (app crashes before here).

Again, it only crashes in WP10. Win10 works fine.

Note: sometimes it doesn't appear to crash, but the updater method is still never called.

I have also tried this sample here: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/FilePickerContracts

And I get similar results in that OnCachedFileUpdaterActivated is only ever called on desktop not phone.

0

There are 0 answers