-
Notifications
You must be signed in to change notification settings - Fork 461
Open
Labels
status:needs-investigationNeeds additional investigationNeeds additional investigation
Description
🐛 Bug Report
I'm trying to use FluentInputFile but have a problem where OnFileUploaded event is called but the file data is only partially available. BytesRead on the buffer doesn't match the expected file size.
What am I doing wrong? Or is this a bug?
💻 Repro or Code Sample
<FluentInputFile @ref="_inputFileRef"
AnchorId="import-button"
DragDropZoneVisible="false"
Accept=".zip,.json"
Multiple="false"
MaximumFileSize="@(100 * 1024 * 1024)"
Mode="InputFileMode.Buffer"
OnFileUploaded="OnFileUploadedAsync" />
<FluentButton Id="import-button"
IconStart="@(new Icons.Regular.Size16.ArrowUpload())"
Loading="@_isImporting"
Title="@Loc[nameof(Dialogs.SettingsImportButtonText)]"
aria-label="@Loc[nameof(Dialogs.SettingsImportButtonText)]">
@Loc[nameof(Dialogs.SettingsImportButtonText)]
</FluentButton>private async Task OnFileUploadedAsync(FluentInputFileEventArgs args)
{
_isImporting = true;
StateHasChanged();
try
{
if (args.Buffer is not null)
{
var ms = new MemoryStream(args.Buffer.Data, 0, args.Buffer.BytesRead);
await TelemetryImportService.ImportAsync(args.Name, ms, CancellationToken.None);
}
}
finally
{
_isImporting = false;
StateHasChanged();
}
}I also tried using stream mode, in which case the app hung while reading from the stream.
And I tried temporary file mode, and the file wasn't fully written to disk, and when I tried to read from it I got an error that the file was in use by another process.
🤔 Expected Behavior
All data is available.
😯 Current Behavior
Not all data is available.
💁 Possible Solution
🔦 Context
🌍 Your Environment
- OS & Device: [e.g. MacOS, iOS, Windows, Linux] on [iPhone 7, PC]
- Browser [e.g. Microsoft Edge, Google Chrome, Apple Safari, Mozilla FireFox]
- .NET and Fluent UI Blazor library Version [e.g. 8.0.2 and 4.4.1]
Metadata
Metadata
Assignees
Labels
status:needs-investigationNeeds additional investigationNeeds additional investigation