Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ISafeSerializationData Interface

Definition

Namespace:
System.Runtime.Serialization
Assemblies:
netstandard.dll, System.Runtime.dll
Assembly:
System.Runtime.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll
Source:
ISafeSerializationData.cs
Source:
ISafeSerializationData.cs
Source:
Opcode.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Caution

Formatter-based serialization is obsolete and should not be used.

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

public interface class ISafeSerializationData
[System.Obsolete("Formatter-based serialization is obsolete and should not be used.", DiagnosticId="SYSLIB0050", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public interface ISafeSerializationData
public interface ISafeSerializationData
[<System.Obsolete("Formatter-based serialization is obsolete and should not be used.", DiagnosticId="SYSLIB0050", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type ISafeSerializationData = interface
type ISafeSerializationData = interface
Public Interface ISafeSerializationData
Attributes

Remarks

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.

Methods

Name Description
CompleteDeserialization(Object)

This method is called when the instance is deserialized.

Applies to

See also


Feedback

Was this page helpful?