UriImageSource caching not implemented for Windows & check TODO comments around caching in general
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 296
Description
### Description
Looking at the `UriImageSource` control, in the `GetStreamAsync` method it states the following which gives the impression that caching is not implemented. I believe that in Xamarin.Forms caching was done directly in `ImageSource` but in MAUI I believe it's done in `UriImageSourceService` for the platforms?
Should this be cleaned up as appropriate?
```csharp
async Task GetStreamAsync(Uri uri, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
Stream stream = null;
if (CachingEnabled)
{
// TODO: CACHING https://github.com/dotnet/runtime/issues/52332
// var key = GetKey();
// var cached = TryGetFromCache(key, out stream)
if (stream is null)
stream = await DownloadStreamAsync(uri, cancellationToken).ConfigureAwait(false);
// if (!cached)
// Cache(key, stream)
}
else
{
stream = await DownloadStreamAsync(uri, cancellationToken).ConfigureAwait(false);
}
return stream;
}
```
### Steps to Reproduce
View the source of UriImageSource.cs
### Version with bug
6.0.408 (current)
### Last version that worked well
Unknown/Other
### Affected platforms
I was *not* able test on other platforms
### Affected platform versions
NA
### Did you find any workaround?
_No response_
### Relevant log output
_No response_
Contributor guide
Research direction
Start with UriImageSource.cs and its GetStreamAsync method, then compare the caching TODO with the ImageSource and UriImageSourceService references in the issue. Check how the Windows path handles CachingEnabled and review related caching TODO comments. Done means the comments and behavior accurately reflect the current caching implementation or its absence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100