Repository navigation
Closed
Labels
Priority:1Created by mkArtakMSFTCreated by mkArtakMSFTarea-blazorBlazor Hybrid / Desktop, BlazorWebViewBlazor Hybrid / Desktop, BlazorWebViewdiscussedCreated by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done.Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done.s/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
Hi everyone! When switching between pages in the app, images aren't loaded from the cache but are reloaded from the server (local folder). Visually, there's a brief flash, followed by the image loading when the page is reloaded. In other words, the image cache isn't working.
Manifest (or serviceworker) cache is not helping.
Steps to Reproduce
- Create MAUI Blazor App
- Add any static (wwwroot) images to any other page
- Navigate to that page
- Navigate back to the homepage
- Navigate to that page again and u still see blinking
Version with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
I was not able test on other platforms
Affected platform versions
Android (Emulator and real device)
Did you find any workaround?
No
Relevant log output
No response
Reacted by TONY HENRIQUE, Cam Warner, Rob Finbow, malciin, Jakub Vojtašák, Samuel Sidor, David Kohout and Jan Klecka
Metadata
Metadata
Assignees
Labels
Priority:1Created by mkArtakMSFTCreated by mkArtakMSFTarea-blazorBlazor Hybrid / Desktop, BlazorWebViewBlazor Hybrid / Desktop, BlazorWebViewdiscussedCreated by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done.Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done.s/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working

Activity
javiercn commentedon Jun 23, 2022
@romanov thanks for contacting us.
Does the same webview instance survive across navigations?
romanov commentedon Jun 23, 2022
How to check it? It's default MAUI Blazor template with default BlazorWebView
javiercn commentedon Jun 24, 2022
@romanov put a static counter variable in your blazor app, increment it every time index is rendered and display the results. That's a good proxy to determine if the blazor webview component is being recreated
romanov commentedon Jun 25, 2022
What is the best method to put the counter's incementation?
protected override async Task OnInitializedAsync()orOnInitialized?Is it right for a blazor page? Or they call everytime on navigation?
I've just tested a blank new MAUI Blazor template and added image to the second view. Same reload.
39 remaining items
Kebechet commentedon Nov 13, 2024
yes, we also have Maui hybrid in production and this really hurts the overall feel of the app
Kebechet commentedon Jan 18, 2025
@mkArtakMSFT is there a chance this will be resolved in some .NET 9 patch release ?
TonyHenrique commentedon Jan 18, 2025
It would be great to see this fixed.
monkeyK1n9 commentedon May 30, 2025
Coming here in 2025, to ask for a fix too, please.
Kebechet commentedon Jun 6, 2025
@jfversluis could this be pushed to NET10 MAUI ?
trajkovdimitar commentedon Jul 3, 2025
Please just retire this technology, if no one is working on it to be usable product.
Kebechet commentedon Apr 1, 2026
@javiercn @mkArtakMSFT can this be prioritized? Or are there any workarounds available? Our Blazor hybrid app is image-heavy and this is a real problem for us
monkeyK1n9 commentedon Apr 1, 2026
I have found a workaround for my app.
I use
IMemoryCachewith the key being the url and value the base64 string of the image.I have an
IImageServicethat will fetch out this image if present. or from the web if not.Invalidate and cache duration and other options are also to be provided.
I hope this is helpful enough. If you need more assistance, let me know.
I am even open to some freelancing 😆
Kebechet commentedon Jun 2, 2026
I looked into this. Sharing the root cause and a proposed approach.
Root cause
BlazorWebViewserves every static asset from the app content root with the response header:The
no-storedirective tells the WebView not to cache anything, so static images (and fonts/CSS) are re-fetched and re-decoded every time a page re-renders them — that re-decode is the visible flicker described here. Manifest/service-worker caching can't override ano-storecoming from the response.The header is set on every platform:
BlazorWebViewHandler.iOS.csStaticContentProvider.GetResponseHeadersWebViewManagerbase classIt was introduced with the original BlazorWebView port and was meant to keep user scripts from being served stale from the WebView cache (the clearer sibling comment in
HybridWebViewreads "Disable local caching which would otherwise prevent user scripts from executing correctly"). That concern is about executable content, but the header is applied to all responses, including inert static assets.Proposed approach
Changing the default to allow caching would be a behavioral breaking change: the WebView cache persists across app updates on all three platforms (Android cache dir, iOS
WKWebsiteDataStore, Windows WebView2 user-data folder), so a bundled asset changed in an update could be served stale.So instead of changing the default, the PR adds an opt-in, additive hook that lets an app choose the
Cache-Controlvalue per resource, with no effect on existing apps:This resolves the flicker for apps that opt in (e.g. caching images) while keeping framework scripts uncached, and gives full per-resource control. Implemented for Android, iOS/MacCatalyst, and Windows.
PR (draft): #35706
If the team would rather also flip the default (opt-out instead of opt-in), the same hook works as the escape hatch — happy to adjust based on what maintainers prefer.
monkeyK1n9 commentedon Jun 3, 2026
@Kebechet please can you show a demo ?
[BlazorWebView] Add opt-in static content caching (#35706)
kubaflo commentedon Oct 10, 2026
Thank you for the report and the investigation details. We are closing this as completed: the .NET 11 development branch implements a bounded per-WebView response cache for the reported reload case when explicitly enabled. Caching remains opt-in, the default no-store behavior is unchanged, and this is not a claim of a .NET MAUI 10 servicing fix.
Supporting evidence: resolution evidence 1.
This records the merged source change; it does not imply that the fix is present in every released .NET MAUI package.