Closed brendandburns closed 1 year ago
If I remove the dw.Read()
in the main
I get:
Hello dotnet world: /
Unhandled Exception:
System.ArgumentException: Stream was not writable.
at System.IO.StreamWriter..ctor(Stream stream, Encoding encoding, Int32 bufferSize, Boolean leaveOpen)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.CreateText(String path)
at DotnetWasm.Write()
at DotnetWasm.Main(String[] args)
We chatted offline, but for anyone else reading this: the File.ReadLines
and File.CreateText
calls (and related APIs) are now fixed in the latest update just published to NuGet.
File.Copy
remains broken because it relies on marshalling SafeHandle
instances in a way that isn't supported yet in this SDK.
I'm going to close this issue because most of it is now dealt with, and the File.Copy
API would be fixed as part of a much broader fix to marshalling which will likely only be done inside dotnet/runtime when this is made really supported.
My code is:
I'm running it in
wasmtime
withwasmtime --mapdir "/::." bin/Debug/net7.0/starter.wasm
If the file "test.txt" exists, then I see:
If the file
test.txt
doesn't exist I see: