Use ImageLoader for store icons, add http error logging, and refactor LoadInternalAsync

Draft
DA
2mo ago
+126-50

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 the IcoPath URL, 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.
  • LoadRemoteImageAsync now reads headers first and checks the status code, so a CDN 4xx/5xx is reported as such rather than as a later decode error.
  • LoadInternalAsync refactored into a flat dispatcher with one helper per source (remote, data, thumbnail), each owning its own recovery.
  • MissingImage, LoadingImage and FolderImage are 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 Image property on PluginStoreItemViewModel (initialized to the shared loading placeholder) instead of IcoPath.
  • Added: LoadIconAsync loads the icon through the API and raises OnPropertyChanged when 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: LoadRemoteImageAsync reads 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 by GetRemoteImageResultAsync, GetDataImageResult, and GetThumbnailResultWithRetryAsync, each handling its own recovery and logging.
  • Memory: no significant impact. Remote images remain cached via ImageCache, and ResponseHeadersRead means 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.