Compartir vía


SecurityException.GetObjectData(SerializationInfo, StreamingContext) Método

Definición

Precaución

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Establece el SerializationInfo con información sobre la SecurityException.

public:
 override void GetObjectData(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
public override void GetObjectData (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}")]
public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
[System.Security.SecurityCritical]
public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
[<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}")>]
override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
[<System.Security.SecurityCritical>]
override this.GetObjectData : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> unit
Public Overrides Sub GetObjectData (info As SerializationInfo, context As StreamingContext)

Parámetros

info
SerializationInfo

SerializationInfo que contiene los datos serializados del objeto que hacen referencia a la excepción que se va a producir.

context
StreamingContext

StreamingContext que contiene información contextual sobre el origen o el destino.

Atributos

Excepciones

El parámetro info es null.

Ejemplos

En el código siguiente se muestra el uso del método para mostrar el estado de GetObjectData permiso contenido en el SerializationInfo objeto .

Display("Demonstrating the use of the GetObjectData "
    "method.");
SerializationInfo^ entryPointSerializatonInfo =
    gcnew SerializationInfo(TestSecurityException::typeid,
    gcnew FormatterConverter);
exception->GetObjectData(entryPointSerializatonInfo,
    *gcnew StreamingContext(StreamingContextStates::All));
Display("The FirstPermissionThatFailed from the call"
    " to GetObjectData is: ");
Display(entryPointSerializatonInfo->GetString(
    "FirstPermissionThatFailed"));
Display("Demonstrating the use of the GetObjectData method.");
SerializationInfo si = new SerializationInfo(
    typeof(EntryPoint), new FormatterConverter());
sE.GetObjectData(si, 
    new StreamingContext(StreamingContextStates.All));
Display("The FirstPermissionThatFailed from the " +
    "call to GetObjectData is: ");
Display(si.GetString("FirstPermissionThatFailed"));
    Display("Demonstrating the use of the GetObjectData method.")
    Dim si As New SerializationInfo( _
        GetType(EntryPoint), New FormatterConverter())
    sE.GetObjectData(si, _
        New StreamingContext(StreamingContextStates.All))
    Display("The FirstPermissionThatFailed from the " & _
        "call to GetObjectData is: ")
    Display(si.GetString("FirstPermissionThatFailed"))
End Try

Comentarios

GetObjectData establece una SerializationInfo con todos los datos del objeto de excepción destinados para la serialización. Durante la deserialización, se reconstituye la excepción a partir de la SerializationInfo transmitida en el flujo.

Se aplica a

Consulte también