This documentation is archived and is not being maintained.

ISafeSerializationData Interface

Enables serialization of custom exception data in security-transparent code.

Namespace:  System.Runtime.Serialization
Assembly:  mscorlib (in mscorlib.dll)

public interface class ISafeSerializationData

The ISafeSerializationData type exposes the following members.

  NameDescription
Public methodCompleteDeserializationThis method is called when the instance is deserialized.
Top

In versions previous to.NET Framework 4.0, serialization of custom user data in a security transparent code was accomplished using the GetObjectData() method. Starting with .NET Framework 4.0, that method is marked with the SecurityCriticalAttribute attribute which prevents execution in security-transparent code. To work around this condition, implement the ISafeSerializationData interface and add custom data as shown in the example below.

The CompleteDeserialization() method is called after serialization, and uses the SafeSerializationEventArgs to restore the custom data.

The following example contains an implementation of the ISafeSerializationData interface that is used to store custom data that is serialized.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: