microsoft / microsoft/fluentui-blazor

Uploading data using the FluentInputFile component is extremely slow on mobile devices.

Open
#2,773 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:blazor area:browsers status:blocked v4
Dominant language
C#
Stars
4.8k
Forks
483
Avg merge
14h 41m
Merged PRs (30d)
68

Description

🐛 Bug Report

Hi.

I'm uploading data on my own network, everything is connected locally, nothing is being sent over external or mobile networks. I'm using Blazor Server. Here's my FluentInputFile on my page:

<FluentInputFile Id="my-upload-buffer" @ref="@myFileByBuffer" AnchorId="MyUploadBuffer"
                             Accept="@GlobalStatics.AuthorizedFileTypes.GetAllTypesSingleString()" DragDropZoneVisible="false"
                             Mode="InputFileMode.Buffer" Multiple="true" OnProgressChange="OnProgressChangeAsync"
                             OnFileUploaded="@OnFileUploaded" MaximumFileSize="@GlobalStaticData.MAX_UPLOAD_SIZE"
                             MaximumFileCount="10" OnCompleted="@OnCompleted" BufferSize="@uploadBufferSize">
</FluentInputFile>

Here's the code which runs on OnProgressChange , I'm just appending the buffer to a file on the server in the same way as the documentation site suggests:

async Task OnProgressChangeAsync(FluentInputFileEventArgs e)
    {
        if (e.IsCancelled)
        {
            progressTitle = "CANCELLED";
        }

        var localFile = Path.Combine(
            webRootPath, GlobalStaticData.PATH_TEMP_UPLOAD,
            e.Name);

        if (!UploadedLocalFiles.ContainsKey(e.Index))
        {
            UploadDetails fileDetails = new()
            {
                FileName = e.Name,
                FileSize = e.Size
            };

            uploadDetails.Add(fileDetails);

            if (File.Exists(localFile))
            {
                File.Delete(localFile);
            }

            UploadedLocalFiles.Add(e.Index, localFile);
        }

        await e.Buffer.AppendToFileAsync(UploadedLocalFiles[e.Index]);
    }

I've got a problem with my data upload component but only on mobile devices.

I've got a 40mb file for reference. If I upload it from Edge on my workstation it successfully gets uploaded in around 3 seconds. If I upload this same file on my Samsung S8 via Edge mobile, it takes around 4 minutes which is strange. I've tried all sorts of different buffer sizes to not much effect (Current is 10240). This happens both in debug mode and also when I've fully deployed it to my internal server.

I've connected my phone to my workstation and profiled the interaction using the Edge remote profiling tools. I start the upload around the 6 second mark and as you can see it's not uploading cleanly in the same way as on desktop as you can see in the profile below this one. I've included the JSON profiling data for both instances at the end of this post.

Mobile (First 20 seconds)

image

Desktop

image

🌍 Your Environment

DotNET version: 8.0.401
Fluent UI Blazor library version: 4.10.1

Traces (OneDrive)

DESKTOP
MOBILE

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the FluentInputFile component and its OnProgressChangeAsync callback, then reproduce the 40 MB upload on Edge mobile and desktop with the posted Buffer mode configuration. Compare the supplied MOBILE and DESKTOP traces while varying BufferSize. Done means the cause of the mobile-only slowdown is identified and a verified fix or documented limitation is demonstrated.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.