FileLoadException Class

The exception that is thrown when a managed assembly is found but cannot be loaded.

Syntax

Declaration

[Serializable]
[ComVisible(true)]
public class FileLoadException : IOException, ISerializable, _Exception

Inheritance Hierarchy

Constructors summary

Initializes a new instance of the FileLoadException class, setting the 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.

Initializes a new instance of the FileLoadException class with the specified error message.

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

Initializes a new instance of the FileLoadException class with a specified error message and the name of the file that could not be loaded.

Initializes a new instance of the FileLoadException class with a specified error message, the name of the file that could not be loaded, and a reference to the inner exception that is the cause of this exception.

Properties summary

Gets the name of the file that causes this exception.

Gets the error message and the name of the file that caused this exception.

Methods summary

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

Constructors

  • FileLoadException()

    Initializes a new instance of the FileLoadException class, setting the 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.

    public FileLoadException()
  • FileLoadException(String)

    Initializes a new instance of the FileLoadException class with the specified error message.

    public FileLoadException(string message)

    Parameters

    • 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.

  • FileLoadException(String, Exception)

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

    public FileLoadException(string message, Exception inner)

    Parameters

    • 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

      The exception that is the cause of the current exception. If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.

  • FileLoadException(String, String)

    Initializes a new instance of the FileLoadException class with a specified error message and the name of the file that could not be loaded.

    public FileLoadException(string message, string fileName)

    Parameters

    • 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.

  • FileLoadException(String, String, Exception)

    Initializes a new instance of the FileLoadException class with a specified error message, the name of the file that could not be loaded, and a reference to the inner exception that is the cause of this exception.

    public FileLoadException(string message, string fileName, Exception inner)

    Parameters

    • 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

      The exception that is the cause of the current exception. If the inner parameter is not null, the current exception is raised in a catch block that handles the inner exception.

Properties

  • FileName

    Gets the name of the file that causes this exception.

    public string FileName { get; }

    Property Value

    • A String containing the name of the file with the invalid image, or a null reference if no file name was passed to the constructor for the current instance.

  • Message

    Gets the error message and the name of the file that caused this exception.

    public override string Message { get; }

    Property Value

    • A string containing the error message and the name of the file that caused this exception.

    Overrides

Methods

  • ToString()

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

    public override string ToString()

    Returns

    • A string containing the fully qualified name of this exception, and possibly the error message, the name of the inner exception, and the stack trace, depending on which FileLoadException constructor is used.

    Overrides

Details

Namespace

System.IO

Assembly

System.Runtime.dll

See Also