File.OpenWrite fails for a non existing file

Jan 6, 2014 at 8:00 PM
File.OpenWrite() fails for a non existing file. It should create a new one according to MS specs.

Changing FileMode.Open to FileMode.OpenOrCreate in :
public static FileStream OpenWrite(string path)
{
 return OpenInternal(null, path, FileMode.Open, 0, FileAccess.Write, FileShare.None, EFileAttributes.Normal);
}
should fix it, I guess (hope);

[ File.Open(path, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.None) works fine! ]
Developer
Jan 6, 2014 at 10:25 PM
Thanks for reporting F!

Will look into it.

Yomodo.
Developer
Jan 6, 2014 at 10:25 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Marked as answer by Yomodo on 1/13/2014 at 2:50 PM