Description
Not sure if it's by design. FileStream Write has no effect when the file is deleted.
Reproduction Steps
using System.IO;
namespace FileStreamTest
{
class Program
{
static void Main(string[] args)
{
string filePath = "a.txt";
FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Delete);
File.Delete(filePath);
fs.WriteByte(65);
fs.Flush();
}
}
}
Expected behavior
Throw an exception.
Actual behavior
Not throw.
Regression?
I checked .NET 4.8 and it has the same behavior.
Known Workarounds
No response
Configuration
.NET 6.0.101
Windows 11 x64, 21H2
Other information
No response
Description
Not sure if it's by design.
FileStreamWrite has no effect when the file is deleted.Reproduction Steps
Expected behavior
Throw an exception.
Actual behavior
Not throw.
Regression?
I checked .NET 4.8 and it has the same behavior.
Known Workarounds
No response
Configuration
.NET 6.0.101
Windows 11 x64, 21H2
Other information
No response