System.IO.FileLoadException Class

public class FileLoadException : IOException

Base Types

Object
  Exception
    SystemException
      IOException
        FileLoadException

Assembly

mscorlib

Library

BCL

Summary

Represents the error that occurs when a Assembly file is found but cannot be loaded.

Description

[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.]

See Also

System.IO Namespace

Members

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


FileLoadException() Constructor

public FileLoadException();

Summary

Constructs and initializes a new instance of the FileLoadException class.

Description

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 .

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException(System.String) Constructor

public FileLoadException(string message);

Summary

Constructs and initializes a new instance of the FileLoadException class with the specified error 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.

Description

This constructor initializes the System.IO.FileLoadException.Message property of the new instance using message. If message is null , 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 .

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException(System.String, System.Exception) Constructor

public FileLoadException(string message, Exception inner);

Summary

Constructs and initializes a new instance of the FileLoadException class.

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

Description

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 is null , 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.]

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException(System.String, System.String) Constructor

public FileLoadException(string message, string fileName);

Summary

Constructs and initializes a new instance of the FileLoadException class.

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.

Description

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 is null , 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.

]

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException(System.String, System.String, System.Exception) Constructor

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

Summary

Constructs and initializes a new instance of the FileLoadException class.

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

Description

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 is null , 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.

]

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException.ToString Method

public override string ToString();

Summary

Returns a string representation of the current exception.

Return Value

A String representation of the current exception.

Description

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 calling ToString on the exception returned by System.IO.FileLoadException.InnerException, and the result of calling System.Environment.StackTrace. If any of these members is null , its value is not included in the returned string.

[Note: This method overrides System.Object.ToString .]

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException.FileName Property

public string FileName { get; }

Summary

Gets the name of the file that caused the current exception.

Property Value

A String containing the name of the file that caused the current exception.

Description

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 .

See Also

System.IO.FileLoadException Class, System.IO Namespace

FileLoadException.Message Property

public override string Message { get; }

Summary

Gets the error message that describes the current exception.

Property Value

A String containing a message that describes the error that caused the current exception.

Description

If the message supplied to the constructor for the current instance was not null , 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 is null , 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 .]

See Also

System.IO.FileLoadException Class, System.IO Namespace