Is an IO exception raised if the disk is full?

What exception was thrown in the .NET Framework when trying to write a file, but the disk is full?

Does Windows buffer file write?

+3
source share
2 answers

You will get an IO exception:

System.IO.IOException: There is not enough space on the disk.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

The library System.IOprocesses the actual read and write tasks to disk and transfers them to managed code, so you should not get unmanaged exceptions using them.

It's also worth a try (with one of those crappy little USB sticks that they give out everywhere) to find out what happens to your code - this is usually the best way to find out.

+6
source

Win 32 , , :

     Win32Exception ex = new Win32Exception();
     string low_level_error = ex.Message;

? FileStream :

" Dispose FileStream, . - , , Dispose , FileStream ".

0

Source: https://habr.com/ru/post/1728042/


All Articles