File​Not​Found​Exception Class

Definition

The exception that is thrown when an attempt to access a file that does not exist on disk fails.

[System.Runtime.InteropServices.ComVisible(true)]
public class FileNotFoundException : System.IO.IOException
Inheritance
Attributes

Inherited Members

System.Exception

System.Object

Remarks

FileNotFoundException uses the HRESULT COR_E_FILENOTFOUND which has the value 0x80070002.

If your code does not have PathDiscovery permission, the error message for this exception may only contain file or directory names instead of fully qualified paths.

Constructors

File​Not​Found​Exception()

Initializes a new instance of the FileNotFoundException class with its message string set to a system-supplied message and its HRESULT set to COR_E_FILENOTFOUND.

File​Not​Found​Exception(​String)

Initializes a new instance of the FileNotFoundException class with its message string set to message and its HRESULT set to COR_E_FILENOTFOUND.

File​Not​Found​Exception(​Serialization​Info, ​Streaming​Context)

Initializes a new instance of the FileNotFoundException class with the specified serialization and context information.

File​Not​Found​Exception(​String, ​Exception)

Initializes a new instance of the FileNotFoundException class with a specified error message and a reference to the inner exception that is the cause of this exception.

File​Not​Found​Exception(​String, ​String)

Initializes a new instance of the FileNotFoundException class with its message string set to message, specifying the file name that cannot be found, and its HRESULT set to COR_E_FILENOTFOUND.

File​Not​Found​Exception(​String, ​String, ​Exception)

Initializes a new instance of the FileNotFoundException class with a specified error message and a reference to the inner exception that is the cause of this exception.

Properties

File​Name

Gets the name of the file that cannot be found.

Fusion​Log

Gets the log file that describes why loading of an assembly failed.

Message

Gets the error message that explains the reason for the exception.

Methods

Get​Object​Data(​Serialization​Info, ​Streaming​Context)

Sets the SerializationInfo object with the file name and additional exception information.

To​String()

Returns the fully qualified name of this exception and possibly the error message, the name of the inner exception, and the stack trace.