this used to be different in 4.8, see: https://gist.github.com/lewurm/f7170d481c1f5f14a0c1294be058020b
this was introduced by https://github.com/mono/mono/commit/c2a7bb4598c3760d439ad00e782ff449a6361c95
it surfaced on android when running the BCL test suite: android mounts the root file system as read-only and also sets CWD=/. In that particular case, it looks like the tests were buggy, but still this is a change in behaviour (see https://github.com/mono/mono/pull/5066 ).
some quotes from slack:
akoeplinger: @ludovic @kumpera ok, I confirmed the behavior is sensible on Windows with .net framework: if you set a partition to read-only, deleting a non-existing file doesn't throw. deleting an existing file throws `IOException: The media is write protected.`
akoeplinger: fwiw .NET Core on Linux throws `Unhandled Exception: System.IO.IOException: Read-only file system` when deleting the non-existing file on a RO FS
I filed a bug on the corefx repo for the .NET Core issue: https://github.com/dotnet/corefx/issues/21273
Working on it.
PR against master: https://github.com/mono/mono/pull/5082
Merged on master, PR against 2017-06: https://github.com/mono/mono/pull/5085