Description
Up until preview6, the blazor filereader Wasm library used unmarshalled calls to communicate the file chunks from js to .net. This is no longer the case due to a breaking change in blazor(mono?) that broke the implementation. Might be something as simple as a name change in the API, have not investigated thoroughly.
Main motivation of reintroducing this thing is speed (~30% faster) and general memory / cpu usage (not really benchmarked though current marshaled memory usage should at minimum the be 2.4 * buffer size compared to unmarshalled)
First issue is how to re-implement the method.
The original implementation passed a reference to a byte array to js in the first call. Current implementations doing about the same thing (ex http message handler in blazor) rather have a call originating from js to allocate and get a reference to that array, which could be considered being the reference implementation.
Second issue, how to enable usage of the method..
As there is still no WASM target for libraries, an initialization option has to be added that enables referencing MonoWebAssemblyJSRuntime.InvokeUnmarshalled<...>
. I'm a little bit unhappy about making end-users do that this as it makes setup quite complex. Might be possible with a simple boolean option but that would cost a lot in reflection instead.