SecurityException::GetObjectData Method (SerializationInfo^, StreamingContext)

 

Sets the SerializationInfo with information about the SecurityException.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

public:
[SecurityCriticalAttribute]
virtual void GetObjectData(
	SerializationInfo^ info,
	StreamingContext context
) override

Parameters

info
Type: System.Runtime.Serialization::SerializationInfo^

The SerializationInfo that holds the serialized object data about the exception being thrown.

context
Type: System.Runtime.Serialization::StreamingContext

The StreamingContext that contains contextual information about the source or destination.

Exception Condition
ArgumentNullException

The info parameter is null.

GetObjectData sets a SerializationInfo with all the exception object data targeted for serialization. During deserialization, the exception is reconstituted from the SerializationInfo transmitted over the stream.

The following code shows the use of the GetObjectData method to display the permission state contained in the SerializationInfo object.

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"));

SecurityCriticalAttribute

requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

.NET Framework
Available since 1.1
Return to top
Show: