Freigeben über


SecurityException.GetObjectData(SerializationInfo, StreamingContext) Methode

Definition

Achtung

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

Legt die SerializationInfo mit Informationen über die SecurityException fest.

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)

Parameter

info
SerializationInfo

Die SerializationInfo, die die serialisierten Objektdaten für die ausgelöste Ausnahme enthält.

context
StreamingContext

Der StreamingContext, der die Kontextinformationen über die Quelle oder das Ziel enthält.

Attribute

Ausnahmen

Der info-Parameter ist null.

Beispiele

Der folgende Code zeigt die Verwendung der GetObjectData -Methode zum Anzeigen des berechtigungsstatus im SerializationInfo -Objekt.

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

Hinweise

Durch GetObjectData wird SerializationInfo mit sämtlichen Ausnahmeobjektdaten festgelegt, die serialisiert werden sollen. Während der Deserialisierung wird die Ausnahme aus der im Datenstrom übertragenen SerializationInfo wieder zusammengesetzt.

Gilt für:

Weitere Informationen