I am having a C# console application access files over a network and write to it. I noticed that some files have been corrupted and have only null written to them. I did not get any exceptions. I am using simple code that writes a byte array to the file's stream. When opening the files in Binary mode, all i see are Zeros, something like "0: 00 00 00 00 10: 00 00 00 00".
Does anyone know why such a thing would happen? There could have been a network failure, but network failures should have thrown some IO exceptions right?
Let me know if anyone has any idea about this.
Code sample:
FileInfo fi = new FileInfo(filePath);
using (FileStream fs = fi.Open (FileMode.Create, FileAccess.Write, FileShare.None))
{
fs.Write(byteData, 0, byteData.Length);
}