SecurityException Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the SecurityException class.
Overloads
| Name | Description |
|---|---|
| SecurityException() |
Initializes a new instance of the SecurityException class with default properties. |
| SecurityException(String) |
Initializes a new instance of the SecurityException class with a specified error message. |
| SecurityException(SerializationInfo, StreamingContext) |
Obsolete.
Initializes a new instance of the SecurityException class with serialized data. |
| SecurityException(String, Exception) |
Initializes a new instance of the SecurityException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
| SecurityException(String, Type) |
Initializes a new instance of the SecurityException class with a specified error message and the permission type that caused the exception to be thrown. |
| SecurityException(String, Type, String) |
Initializes a new instance of the SecurityException class with a specified error message, the permission type that caused the exception to be thrown, and the permission state. |
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
SecurityException()
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
Initializes a new instance of the SecurityException class with default properties.
public:
SecurityException();
public SecurityException();
Public Sub New ()
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Remarks
The following table shows the initial property values for an instance of the SecurityException class.
| Property | Value |
|---|---|
| InnerException | A null reference (Nothing in Visual Basic). |
| Message | The localized error message string. |
Applies to
SecurityException(String)
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
Initializes a new instance of the SecurityException class with a specified error message.
public:
SecurityException(System::String ^ message);
public SecurityException(string? message);
public SecurityException(string message);
new System.Security.SecurityException : string -> System.Security.SecurityException
Public Sub New (message As String)
Parameters
- message
- String
The error message that explains the reason for the exception.
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Remarks
The following table shows the initial property values for an instance of the SecurityException class.
| Property | Value |
|---|---|
| InnerException | A null reference (Nothing in Visual Basic). |
| Message | The localized error message string. |
Applies to
SecurityException(SerializationInfo, StreamingContext)
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
Caution
This API supports obsolete formatter-based serialization. It should not be called or extended by application code.
Initializes a new instance of the SecurityException class with serialized data.
protected:
SecurityException(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected SecurityException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
protected SecurityException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.SecurityException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.SecurityException
new System.Security.SecurityException : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Security.SecurityException
Protected Sub New (info As SerializationInfo, context As StreamingContext)
Parameters
- info
- SerializationInfo
The object that holds the serialized object data.
- context
- StreamingContext
The contextual information about the source or destination.
- Attributes
Exceptions
info is null.
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Remarks
This constructor is called during deserialization to reconstitute the exception object transmitted over a stream.
This constructor sets the following property values based on the information in the info parameter:
Applies to
SecurityException(String, Exception)
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
Initializes a new instance of the SecurityException class with a specified error message and a reference to the inner exception that is the cause of this exception.
public:
SecurityException(System::String ^ message, Exception ^ inner);
public SecurityException(string? message, Exception? inner);
public SecurityException(string message, Exception inner);
new System.Security.SecurityException : string * Exception -> System.Security.SecurityException
Public Sub New (message As String, inner As Exception)
Parameters
- message
- String
The error message that explains the reason for the exception.
- inner
- Exception
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.
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Remarks
An exception that is thrown as a direct result of a previous exception should include a reference to the previous exception in the InnerException property. The InnerException property returns the same value that is passed into the constructor, or null if the InnerException property does not supply the inner exception value to the constructor.
The following table shows the initial property values for an instance of the SecurityException class.
| Property | Value |
|---|---|
| InnerException | The inner exception reference. |
| Message | The localized error message string. |
See also
Applies to
SecurityException(String, Type)
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
Initializes a new instance of the SecurityException class with a specified error message and the permission type that caused the exception to be thrown.
public:
SecurityException(System::String ^ message, Type ^ type);
public SecurityException(string? message, Type? type);
public SecurityException(string message, Type type);
new System.Security.SecurityException : string * Type -> System.Security.SecurityException
Public Sub New (message As String, type As Type)
Parameters
- message
- String
The error message that explains the reason for the exception.
- type
- Type
The type of the permission that caused the exception to be thrown.
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Remarks
The following table shows the property values set by this constructor.
| Property | Value |
|---|---|
| Message | The localized error message string specified by message. |
| PermissionType | The Type of the permission that failed, specified by type. |
Applies to
SecurityException(String, Type, String)
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
- Source:
- SecurityException.cs
Initializes a new instance of the SecurityException class with a specified error message, the permission type that caused the exception to be thrown, and the permission state.
public:
SecurityException(System::String ^ message, Type ^ type, System::String ^ state);
public SecurityException(string? message, Type? type, string? state);
public SecurityException(string message, Type type, string state);
new System.Security.SecurityException : string * Type * string -> System.Security.SecurityException
Public Sub New (message As String, type As Type, state As String)
Parameters
- message
- String
The error message that explains the reason for the exception.
- type
- Type
The type of the permission that caused the exception to be thrown.
- state
- String
The state of the permission that caused the exception to be thrown.
Examples
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Remarks
The following table shows the property values set by this constructor.
| Property | Value |
|---|---|
| Message | The localized error message string specified by message. |
| PermissionType | The Type of the permission that failed, specified by type. |
| Demanded | The demanded security permission, permission set, or permission set collection that failed. |