How can we improve the Windows dev platform?

StorageFile.GetThumbnailAsync doesn't wait for thumbnail to be generated

Calling StorageFile.GetThumbnailAsync(ThumbnailMode.SingleItem, desiredSize) doesn't wait for the thumbnail to be generated. If there isn't one already cached, it will return an icon instead. Disposing the stream then waiting for 6 seconds then trying again correctly returns a thumbnail.

3 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Ben Stevens shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Ben Stevens commented  ·   ·  Flag as inappropriate

        Actually, it seems like a few more steps are required to produce this error, and it involves OneDrive. A test image is provided here - https://1drv.ms/u/s!AnQ-_3An97TMgrJgBTqEQcm0YhTxaA.

        1. Make sure the OneDrive setting 'Save space and download files as you use them' is on.
        2. Make sure the Photos app is not set as the default program for opening .jpg files. Set it to a third-party Store app instead. (I think this might be because Photos will generate thumbnails in the background or something).
        3. Copy the image to the OneDrive folder. It doesn't matter if it is set to always available on this device or just available on this device.
        4. Use my sample app - https://1drv.ms/u/s!AnQ-_3An97TMgrJednocacy9KnI6MQ - to open the image (using the 'Select image' button) and wait for the image to load.
        If that produces the error, you can also try adding a step in between 3 and 4, which sets the Photos app back to being the default file handler for .jpg files, and the error still occurs in this case for me.

      • Ben Stevens commented  ·   ·  Flag as inappropriate

        Some extra info - I'm opening the image file using a file open picker. The file is not in my app's data folder. Images tested are 20MP JPEGs.

      Feedback and Knowledge Base