AspNetCore.Docs
AspNetCore.Docs copied to clipboard
Streamed image not displayed
I tried the code from the Stream image data to a client section (I copy-pasted in a new Blazor WebAssembly application), using the setImage JS function from the previous section.
The image is not displayed (only the alt image). If I remove the URL.revokeObjectURL call, the image is correctly displayed.
I suspect the URL being revoked too soon. I'm not sure how to call the revoke later (I'm not in an EditForm), so as to avoid memory leaks from that page.
(edited) Changing the last JS line seems to be working:
setTimeout(() => URL.revokeObjectURL(url), 0)
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 66bb1712-60ac-77a6-10d2-f2d795126783
- Version Independent ID: 66bb1712-60ac-77a6-10d2-f2d795126783
- Content: Work with images in ASP.NET Core Blazor
- Content Source: aspnetcore/blazor/images.md
- Product: aspnet-core
- Technology: aspnetcore-blazor
- GitHub Login: @guardrex
- Microsoft Alias: taparik
Hello @GerardFR ... Thanks for the report.
Ping @TanayParikh for assistance.
Hey @GerardFR, can you please confirm if you're using .NET 6? A minimal, public, GitHub repro would also assist with the investigation.
Hi @TanayParikh , yes, I'm using .NET 6. Please see repo here: https://github.com/GerardFR/ImageStreaming/tree/master
@GerardFR ... FYI, there's a delay on working doc issues at the moment due to high priority work on .NET 7. We'll get back to this ASAP 🏃😅.
@GerardFR ... I don't have an ETA yet for returning to this. The product unit is 🏃😅 on high priority issues for .NET 7's upcoming release at the moment. We'll get back to this ASAP.
UPDATE (8/11): We're still delayed due to the work for the upcoming .NET 7 release. We'll get to this ASAP, but I don't have an ETA yet.
UPDATE (8/11): We're still delayed due to the work for the upcoming .NET 7 release. We'll get to this ASAP, but I don't have an ETA yet.
@guardrex I'm pretty sure this is now resolved based on the PR/issue we were discussing yesterday (onload revoke object url).
Ok, cool. Thx, @TanayParikh. In that case, we'll just need to touch base at some point on Steve's remarks in the other issue ...
The "Preview an image provided by the InputFile component" content seems strange https://github.com/dotnet/AspNetCore.Docs/issues/26276
I wasn't quite able to grok his proposed solution for image previews. I came up with something, but it didn't match the language that he used and that you seemed to get at ...
https://github.com/dotnet/AspNetCore.Docs/issues/26276#issuecomment-1171630234
It's best for me if you could whip up a component example for what Steve is proposing. I'm fairly certain that I can understand it from the code. I'll write it up based on that.
Ok ... closing this now ... and we can continue on the other issue whenever ur free to look at it.
btw - Today, I'm buried in macOS/VS4Mac Blazor guidance ... and possibly Friday, too, because we might be working up specific VS4Mac Blazor Hybrid (.NET MAUI) tutorial guidance. Therefore, you could definitely not sweat that other issue in the near-term ... I wouldn't even be able to look at it until next week.