![]() As a result, unexpected exceptions can occur. However, the precise conditions under which the operating system returns particular error codes is often undocumented or poorly documented. In most cases, it does this by directly translating the error code into its corresponding exception type it does not perform any special mapping of the error based on the context of the method call.įor example, on the Windows operating system, a method call that returns an error code of ERROR_FILE_NOT_FOUND (or 0x02) maps to a FileNotFoundException, and an error code of ERROR_PATH_NOT_FOUND (or 0x03) maps to a DirectoryNotFoundException. The method then translates the error information, typically in the form of an error code, into a. When an I/O error occurs in code executed by the operating system, the operating system returns error information to the. NET Framework wrap calls to the underlying operating system. NET Framework.)īecause the file system is an operating system resource, I/O methods in both. , which is thrown for applications running in limited trust that lack the necessary permissions on.System.NotSupportedException, which is thrown for invalid colons in.System.ArgumentException, which is thrown for invalid path characters on.It is thrown for errors whose return codes from the operating system don't directly map to any other exception type. ![]() System.IO.IOException, the base class of all System.IO exception types. ![]() NET file system methods can throw the following exceptions: In addition to the exceptions that can be thrown in any method call (such as an OutOfMemoryException when a system is stressed or an NullReferenceException due to programmer error). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |