microsoft / microsoft/microsoft-ui-xaml
BitmapImage URI download hangs indefinitely when network drops mid-transfer
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
Component: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.bitmapimage
When a BitmapImage is loading from an HTTP URI and the network connection drops after the request starts, the download hangs forever and `ImageFailed` never fires. The BitmapImage remains in a permanent loading state. Even after the network recovers, the stalled download does not resume or error out.
### Why is this important?
In our application, we display a grid of ~20 images loaded from CDN URLs. If a user's network briefly drops or becomes unstable mid-load, the affected images show infinite loading spinners that never resolve. We want to remove the pending image downloads from UI in such cases or show an error but since `bitmap.ImageFailed` doesn't fire there doesn't seem to be a documented way to do so.
### Steps to reproduce the bug
1. Create a `BitmapImage` and set UriSource to a valid HTTP URL (use a large image or throttled server for easier repro).
1. Wait for the HTTP request to start
1. Disconnect the network
1. Wait 20+ minutes. Observation: ImageFailed never fires.
1. Reconnect the network. Observation: the stalled download does not resume or fail, it remains stuck indefinitely.
### Actual behavior
The pending image downloads get stuck in an infinite loading state on a network drop.
### Expected behavior
Either:
- [ImageFailed](https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.media.imaging.bitmapimage.imagefailed) should fire after a (configurable?) timeout when the underlying HTTP transfer stalls so based on it we can retry, show an error state, or clean up. The download should not hang silently forever.
OR
- Once the network reconnects, the pending download should resume/retry and fetch the complete image.
### Screenshots
_No response_
### NuGet package version
Microsoft.WindowsAppSDK 1.6.250108002
### Windows version
Windows 11 (25H2): Build 26200
### Additional context
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with a BitmapImage loading a large HTTP image, then disconnect the network after the request begins and observe ImageFailed and recovery behavior. Trace the BitmapImage image-download path and its handling of stalled transfers. Done means a stalled download either raises ImageFailed after a defined timeout or resumes/retries after connectivity returns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100