TechNet
Export (0) Print
Expand All

SecurityException.GetObjectData Method (SerializationInfo, StreamingContext)

 

Sets the SerializationInfo with information about the SecurityException.

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

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

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

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:
© 2016 Microsoft