FileOpenPicker return null? RRS feed

  • Question

  • Hi everybody!

    I'm working with FileOpenPicker it's working fine and my app live on Store. But a blue sky day it's not return null but cannot get file Path.

    public class VideoInfo
            public BitmapImage Thumb { get; set; }
            public string FileName { get; set; }
            public string FilePath { get; set; }
            public DateTimeOffset DateCreate { get; set; }
    private async void ButtonOpenFile_OnClick(object sender, RoutedEventArgs e)
                FileOpenPicker openPicker = new FileOpenPicker();
                openPicker.ViewMode = PickerViewMode.Thumbnail;
                openPicker.SuggestedStartLocation = PickerLocationId.VideosLibrary;
                StorageFile file = await openPicker.PickSingleFileAsync();
                if (file != null)
                    VideoInfo video = new VideoInfo { FileName = file.Name,FilePath = file.Path, DateCreate = file.DateCreated};
                    this.Frame.Navigate(typeof(MediaPlayerPage), video);

    OutPut Windows DO NOT any error message!

    Sunday, April 8, 2018 3:45 AM


All replies

  • hi

    what's the result if you examine the "file" object, what's the content ?

    it's not null so FileOpenPicker returns an object...


    Sunday, April 8, 2018 12:09 PM
  • do all the properties you are trying use from the file contain values?
    Sunday, April 8, 2018 12:15 PM
  • This is file after pick

    Sunday, April 8, 2018 1:50 PM
  • No sir! all Properties null. but file object not null
    Sunday, April 8, 2018 1:51 PM
  • "file" does not look like a StorageFile, what if you rename it to something else ?

    StorageFile _storage = …

    Sunday, April 8, 2018 2:07 PM
  • Thank for your reply!

    I have try rename _file or var file = …

    Still happen!

    Sunday, April 8, 2018 2:47 PM
    • Proposed as answer by Barry Wang Tuesday, April 17, 2018 9:20 AM
    • Marked as answer by Nguyen_Thanh_Liem Tuesday, June 19, 2018 1:48 PM
    Sunday, April 8, 2018 4:29 PM
  • I have try rename my video try put on different location D:, C: Desktop.

    Why my app working good and it live on Store. A few day later I download my app from Store it still error?

    Monday, April 9, 2018 2:18 PM
  • @Nguyen_Thanh_Liem,

    Actually I recommend that you don't show the path info which relies on this property. As above mentioned that the file is not guaranteed to have a file-system path. 

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 11, 2018 3:12 AM