SecurityException.GetObjectData Method (SerializationInfo, StreamingContext)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Sets the SerializationInfo with information about the SecurityException.

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

Public Overrides Sub GetObjectData (
	info As SerializationInfo,
	context As StreamingContext


Type: System.Runtime.Serialization.SerializationInfo

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

Type: System.Runtime.Serialization.StreamingContext

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

Exception Condition

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.")
    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: ")
End Try


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