Blazor @OnClick on MacOS .net 6+

30 views Asked by At

I have deployed my Blazor App .Net6 (tried 7.0 too) on a Webserver.

This is a very simple app with One InputFile, and One Button.

When I upload a file, I can use any buttons afteward.

It Looks like the file dialog on Ios breaks the single page app lifecycle, is there a way to restore it?

1

There are 1 answers

0
Linken On

So, It has nothing to do with events, and all with the handling of the stream I used.

Make absolutly sure that you close and dispose any stream from the inputfile event. Otherwise all events will be frozen.

GOOD Handling :

   Buffer = new byte[file.Size];
    using (var Stream = file.OpenReadStream())
    {
        await Stream.ReadAsync(Buffer);
    }

BAD Handling this will DISABLE all buttons.

await file.OpenReadStream().ReadAsync(Buffer);