Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileIO bug for Test when opening new file for writing #1297

Open
janigbg opened this issue Feb 9, 2024 · 0 comments
Open

FileIO bug for Test when opening new file for writing #1297

janigbg opened this issue Feb 9, 2024 · 0 comments

Comments

@janigbg
Copy link

janigbg commented Feb 9, 2024

When opening a new file for writing using the FileIO Test implementation I get a FileNotFoundException.
According to Microsoft docs the File.OpenWrite() method used should allow that:
https://learn.microsoft.com/en-us/dotnet/api/System.IO.File.OpenWrite?view=net-7.0#remarks

The FileMode is currently set to Open instead of OpenOrCreate in the test implementation.

Repro (this should not fail):

var effect =
    File<Runtime>.openWrite("c:\\file")
    | Consumer.mapM<Runtime, Stream, Unit>(_ => unitEff);

var result = await effect.RunEffect().Run(Runtime.New());
result.ThrowIfFail();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant