mscorlib 2.0.0.0 4.0.0.0 System.SystemException System.Runtime.InteropServices.ComVisible(true)

A attribute is used to determine if a type or member can be loaded, based on the host’s protection preferences established when the common language runtime is started. If a type or member with an active is called, a link demand occurs for that protection attribute. If the caller does not meet the demand for host protection, a is thrown.

A is not a permission, even though it is the target of a link demand. Because a is thrown for a link demand, it cannot be handled, and therefore it cannot be trapped and processed in code.

The exception that is thrown when a denied host resource is detected.

- Constructor
  2.0.0.0
  4.0.0.0

  The following table shows the initial property values for an instance of the class.

  Property

  Value

  Initializes a new instance of the class with default values.

- Constructor
  2.0.0.0
  4.0.0.0

  The content of the parameter should be understandable to the user. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

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

  The message that describes the error.
- Constructor
  2.0.0.0
  4.0.0.0

  This constructor is called during deserialization to reconstruct the exception object transmitted over a stream.

  Initializes a new instance of the class using the provided serialization information and streaming context.

  The object that holds the serialized object data.
  Contextual information about the source or destination.
- Constructor
  2.0.0.0
  4.0.0.0

  An exception that is thrown as a direct result of a previous exception can include a reference to the previous exception in the property. The property returns the same value that is passed into the constructor, or null if the property does not supply the inner exception value to the constructor.

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

  The error message that explains the reason for the exception.
  The exception that is the cause of the current exception. If the parameter is not null, the current exception is raised in a catch block that handles the inner exception.
- Constructor
  2.0.0.0
  4.0.0.0

  The parameter specifies the demanded host protection categories that caused the exception to be thrown. For example, suppose that a method has a attribute that indicates that the method exposes shared state. When the method is called, the performs a link demand for shared state. If the host has set shared state as a prohibited category, then a is raised with a property value of .

  Initializes a new instance of the class with a specified error message, the protected host resources, and the host resources that caused the exception to be thrown.

  The error message that explains the reason for the exception.
  A bitwise combination of the enumeration values that specify the host resources that are inaccessible to partially trusted code.
  A bitwise combination of the enumeration values that specify the demanded host resources.
- Property
  2.0.0.0
  4.0.0.0
  System.Security.Permissions.HostProtectionResource To be added.

  This property returns the demanded host protection categories that caused the exception to be thrown. For example, suppose that a method has a attribute that indicates that the method exposes shared state. When the method is called, the performs a link demand for shared state. If the host has set shared state as a prohibited category, then a is raised, and the value of the property is .

  Gets or sets the demanded host protection resources that caused the exception to be thrown.

- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  The method sets a object with all the exception object data targeted for serialization. During deserialization, the exception is reconstructed from the transmitted over the stream.

  Sets the specified object with information about the host protection exception.

  The serialized object data about the exception being thrown. The contextual information about the source or destination.
- Property
  2.0.0.0
  4.0.0.0
  System.Security.Permissions.HostProtectionResource To be added.

  This property identifies the host protection categories that the host has specified as being inaccessible to code that is not fully trusted.

  Gets or sets the host protection resources that are inaccessible to partially trusted code.

- Method
  2.0.0.0
  4.0.0.0
  System.String

  The returned string is a textual representation of the exception.

  Returns a string representation of the current host protection exception.

  A string representation of the current .