I received a very weird IOException when writing to an XML file:
System.IO.IOException: The requested operation cannot be performed on a file with a user-map
The OS or Framework can fail you, if you try to open the same file over and over again in a tight loop, for example
while (true) {
File.WriteAllLines(...)
}
Of course, you don't want to actually do that. But a bug in your code might cause that to happen. The crash is not due to your code, but a problem with Windows or the .NET Framework.
If you have to write lots of files very quickly, you could add a small delay with Thread.Sleep() which also seems to get the OS off your back.
while (i++<100000000) {
File.WriteAllLines(...)
Thread.Sleep(1);
}