public class FileLoadException : IOException
Object
Exception
SystemException
IOException
FileLoadException
mscorlib
BCL
Represents the error that occurs when a Assembly file is found but cannot be loaded.
[Note: The FileNotFoundException exception is thrown when the file fails to load because it cannot be located. If the file is located, but cannot be loaded due to insufficient permissions, a SecurityException is thrown.]
System.IO Namespace
FileLoadException Constructors
FileLoadException() Constructor
FileLoadException(System.String) Constructor
FileLoadException(System.String, System.Exception) Constructor
FileLoadException(System.String, System.String) Constructor
FileLoadException(System.String, System.String, System.Exception) Constructor
FileLoadException Methods
FileLoadException.ToString Method
FileLoadException Properties
FileLoadException.FileName Property
FileLoadException.Message Property
public FileLoadException();
Constructs and initializes a new instance of the FileLoadException class.
This constructor initializes the System.IO.FileLoadException.Message property of the new instance to a system-supplied message that describes the error, such as "Could not load the specified file." This message takes into account the current system culture.The System.IO.FileLoadException.InnerException property and System.IO.FileLoadException.FileName property of the new instance are initialized to
null
.
System.IO.FileLoadException Class, System.IO Namespace
public FileLoadException(string message);
Constructs and initializes a new instance of the FileLoadException class with the specified error message.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
This constructor initializes the System.IO.FileLoadException.Message property of the new instance using message. If message isnull
, the System.IO.FileLoadException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.The System.IO.FileLoadException.InnerException property and System.IO.FileLoadException.FileName property of the new instance are initialized to
null
.
System.IO.FileLoadException Class, System.IO Namespace
public FileLoadException(string message, Exception inner);
Constructs and initializes a new instance of the FileLoadException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- inner
- An instance of Exception that is the cause of the current exception. If inner is non-null, then the current exception was raised in a catch block handling inner.
This constructor initializes the System.IO.FileLoadException.Message property of the new instance using message and the System.IO.FileLoadException.InnerException property using inner. If message isnull
, the System.IO.FileLoadException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.The System.IO.FileLoadException.FileName property of the new instance is initialized to
null
.[Note: For more information on inner exceptions, see System.Exception.InnerException.]
System.IO.FileLoadException Class, System.IO Namespace
public FileLoadException(string message, string fileName);
Constructs and initializes a new instance of the FileLoadException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- fileName
- A String containing the name of the file that was not loaded.
This constructor initializes the System.IO.FileLoadException.Message property of the new instance using message and the System.IO.FileLoadException.FileName property using fileName. If message isnull
, the System.IO.FileLoadException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.The System.IO.FileLoadException.InnerException property of the new instance is initialized to
null
.[Note: System.IO.FileLoadException.FileName is not required to be a file stored on disk; it can be any part of a system that supports access via streams. For example, depending on the system, this class might be able to access a physical device.
]
System.IO.FileLoadException Class, System.IO Namespace
public FileLoadException(string message, string fileName, Exception inner);
Constructs and initializes a new instance of the FileLoadException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- fileName
- A String containing the name of the file that was not loaded.
- inner
- An instance of Exception that is the cause of the current exception. If inner is non-null, then the current exception was raised in a catch block handling inner.
This constructor initializes the System.IO.FileLoadException.Message property of the new instance using message, the System.IO.FileLoadException.InnerException property using inner, and the System.IO.FileLoadException.FileName property using fileName. If message isnull
, the System.IO.FileLoadException.Message property is initialized to the system-supplied message provided by the constructor that takes no arguments.[Note: System.IO.FileLoadException.FileName is not required to be a file stored on disk; it can be any part of a system that supports access via streams. For example, depending on the system, this class might be able to access a physical device.
For more information on inner exceptions, see System.Exception.InnerException.
]
System.IO.FileLoadException Class, System.IO Namespace
public override string ToString();
Returns a string representation of the current exception.
A String representation of the current exception.
The string representation returned by this method includes the value of the System.IO.FileLoadException.Message property, the value of the System.IO.FileLoadException.FileName property, the result of callingToString
on the exception returned by System.IO.FileLoadException.InnerException, and the result of calling System.Environment.StackTrace. If any of these members isnull
, its value is not included in the returned string.[Note: This method overrides System.Object.ToString .]
System.IO.FileLoadException Class, System.IO Namespace
public string FileName { get; }
Gets the name of the file that caused the current exception.
A String containing the name of the file that caused the current exception.
This property is read-only.This property returns the name of the file supplied to the constructor for the current instance, if any. If the file name was not specified or is a null reference, this property returns
null
.
System.IO.FileLoadException Class, System.IO Namespace
public override string Message { get; }
Gets the error message that describes the current exception.
A String containing a message that describes the error that caused the current exception.
If the message supplied to the constructor for the current instance was notnull
, this property returns that message. Otherwise, this property returns a system-supplied message that includes the name of the file that was not loaded, for example, "Unable to load file a FileName." (a FileName represents the value returned by System.IO.FileLoadException.FileName.) If System.IO.FileLoadException.FileName isnull
, this is indicated in the system-supplied message as "(null)". The system-supplied message takes into account the current system culture.This property is read-only.
[Note: This property overrides System.Exception.Message .]
System.IO.FileLoadException Class, System.IO Namespace