Skip to content

Unable to use file read with server-side preview6 #54

Closed
@tmarkovski

Description

@tmarkovski

Describe the bug
Can't use the file reader component with server side Blazor. The signalr connection fails. On the backend side, the code just hangs when attempting to read from the stream at await stream.ReadAsync
Due to other dependencies with the project, I'm unable to use net 3.0 preview7 at this time.

To Reproduce
Steps to reproduce the behavior:
Pretty much using the suggested code to reproduce this.

public async Task<string> GetImagePathAsync()
{
    foreach (var file in await FileService.CreateReference(FileElement).EnumerateFilesAsync())
    {
        var fileInfo = await file.ReadFileInfoAsync();
        using var stream = await file.OpenReadAsync();
        var imageData = new byte[stream.Length];
        await stream.ReadAsync(imageData, 0, (int)stream.Length);

        using var imageStream = new MemoryStream(imageData);
        return await Client.UploadImageAsync(imageStream, fileInfo.Name, fileInfo.Type);
    }
    return null;
}

Project type
Server-side

Environment

  • Browser: Safari, Firefox and Chrome
  • Version of Blazor.FileReader - 0.12.19186
  • Version of .net sdk - 3.0.100-preview6-012264

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions