Open
Description
Description
Calling System.IO.Directory.CreateTempSubdirectory(String prefix)
fails with an exception in a wasi-wasm build
Reproduction Steps
- .Net version 8.0.100-rc.1.23455.8
- tempDir.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>
<OutputType>Exe</OutputType>
<PublishTrimmed>true</PublishTrimmed>
<WasmSingleFileBundle>true</WasmSingleFileBundle>
</PropertyGroup>
</Project>
- Program.cs
using System;
using System.IO;
using System.Text;
Console.WriteLine("Hello, Wasi Console!");
using (var writer = File.Create("/tmp/test.txt")) {
writer.Write(Encoding.UTF8.GetBytes("Hello World!"));
}
var dir = Directory.CreateTempSubdirectory();
Console.WriteLine("Created temp dir: " + dir.FullName);
- dotnet build
- create a tmp directory in the workspace directory
- wasmtime 12.0.2
- run
wasmtime run --mapdir /::. --env TMPDIR=/tmp obj/Debug/net8.0/wasi-wasm/wasm/for-build/tempDir.wasm
Expected behavior
Creating the temp directory works
Actual behavior
System.IO.IOException: Success
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
at Interop.ThrowIOExceptionForLastError()
at System.IO.Directory.CreateTempSubdirectoryCore(String prefix)
at System.IO.Directory.CreateTempSubdirectory(String prefix)
at Program.<Main>$(String[] args)
The write to the file happened successful.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response