SecurityException.GetObjectData Method (SerializationInfo, StreamingContext)
![]() |
---|
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience. |
Sets the SerializationInfo with information about the SecurityException.
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"));
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Available since 1.1