Use ImageLoader for store icons, add http error logging, and refactor LoadInternalAsync
Adds the logging requested in #4594
May also possibly fix that issue and #4566
Key changes:
- Plugin store icons now load through the API (
LoadImageAsync/ImageLoader) instead of binding directly to theIcoPathURL, so they get caching, hash dedup and the missing image fallback. - Remote icon loads are now logged with the reason (transport error or HTTP status) instead of being silently swallowed.
LoadRemoteImageAsyncnow reads headers first and checks the status code, so a CDN 4xx/5xx is reported as such rather than as a later decode error.LoadInternalAsyncrefactored into a flat dispatcher with one helper per source (remote,data,thumbnail), each owning its own recovery.MissingImage,LoadingImageandFolderImageare now held outside the image cache instead of being read back out of it.
Why the last point matters: the fallback placeholders were ordinary entries in the LFU image cache (MaxCached = 150), which evicts its least used entries. The seeded placeholders are the oldest and least used, so a load burst past the cap evicts them, MissingImage then returns null, and failed loads render blank instead of showing the placeholder for the rest of the session since nothing re-seeds them. Routing store icons through ImageLoader is what made this visible, because the store loads 200+ icons at once.
Summary by cubic
Summary of changes
Plugin store icons now load through the API via LoadImageAsync / ImageLoader instead of binding directly to the IcoPath URL, so they get caching, hash deduplication, and the missing-image fallback. LoadInternalAsync was refactored into a flat dispatcher where each image source owns its own error handling.
- Changed: store icons bind to the new lazy-loaded
Imageproperty onPluginStoreItemViewModel(initialized to the shared loading placeholder) instead ofIcoPath. - Added:
LoadIconAsyncloads the icon through the API and raisesOnPropertyChangedwhen the image is ready. - Added: remote and data-URI image failures are now logged with the failure reason; data-URI failures were previously swallowed silently.
- Changed:
LoadRemoteImageAsyncreads response headers first and checks the HTTP status before downloading the body, so a CDN 4xx/5xx is reported as an HTTP error (HttpRequestException) rather than a later decode error. - Removed: the single large try/catch wrapper in
LoadInternalAsync, replaced byGetRemoteImageResultAsync,GetDataImageResult, andGetThumbnailResultWithRetryAsync, each handling its own recovery and logging. - Memory: no significant impact. Remote images remain cached via
ImageCache, andResponseHeadersReadmeans the response body is only downloaded after the status check passes. - Security: no new risk. Rejecting non-success statuses prevents an error-page body from reaching the bitmap decoder; data-URI handling is unchanged apart from logging.
- Tests: no unit tests were added or updated in this PR.
Release Note
Plugin store icons now load more reliably with clearer error handling, so icon failures are reported instead of silently showing broken images.