Problems with FileStream.ReadAsync on WebGL loading of idbfs files

Hey there,

so, when I try to load files in the browser from the idbfs storage using ReadAsync, the file after the await never executes. It also doesn’t send an error, it just fails.

Using synchronous Read() works, but that just feels so clunky to me.

        log.debug("[GLTFLoader]: Opening Filestream to " + filePath);
        using (FileStream SourceStream = File.Open(filePath, FileMode.Open))
        {
            result = new byte[SourceStream.Length];
            log.debug("[GLTFLoader]: SourceStream " + SourceStream);
            SourceStream.Read(result, 0, (int)SourceStream.Length);
            // await SourceStream.ReadAsync(result, 0, (int)SourceStream.Length);
        }
        log.debug("[GLTFLoader]: finished loading " + result.Length);
        return result;

Has anyone tried this before and got it to work using async+await?

(Both methods work great in the editor or on macOS or Android)

This would be interesting for us to take a peek. not sure what the discrepancy between WebGL and other platforms would be here. Would you be able to report this as a bug?

I experience the same behaviour on an Oculus Quest using Unity 2020.1.17f. The code below

using (FileStream SourceStream = File.Open(filePath, FileMode.Open) )
{
....

never executes and leaves my task without doing anything :confused:

It would be great if this can be reported as a bug along with a test case, that would get the QA team attention to investigate the issue!