Open zxyao145 opened 4 years ago
/cc @lewing
@tqiu8 can you try to reproduce this?
Having trouble on VS but still seems to be a problem on VSCode
I can reproduce this on 3.2 it works correctly on 5
using System;
using System.IO;
using System.Threading.Tasks;
namespace Bmem
{
class Program
{
static async Task Main(string[] args)
{
var data = new byte [] {1,2,3,4};
await CreateMemoStream (data);
}
private static async Task<Stream> CreateMemoStream(byte[] bytes)
{
Stream s = new MemoryStream();
await s.WriteAsync(bytes);
s.Position = 0;
await s.FlushAsync();
//debug
var br = new BinaryReader(s);
var bytes2 = new byte[s.Length];
br.Read(bytes2);
Console.WriteLine(string.Join(',', bytes2));// here is "0,0,0,...,0"
return s;
}
}
}
@baulig can you take a look at this?
Describe the bug
I'm trying to read a file in blazor (wasm), but I get an error result. All MemoryStream bytes are 0. The code is as follows, and I'm sure the bytes have data (I printed them in the console).
To Reproduce
Exceptions (if any)
Further technical details