NameInvariantSurrogateSelector Class
Note: This API is now obsolete.
An
ISurrogateSelector implementation that makes possible to serialize and deserialize objects by
IFormatters without storing field names. This provides compatibility for obfuscated and non-obfuscated versions of an assembly.
Namespace: KGySoft.Serialization.BinaryAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
[ObsoleteAttribute("It's not recommended to use this class. If you need to make different kinds of builds of an assembly binary serialization-compatible, then it is a sign that binary serialization is used in an insecure way.")]
public class NameInvariantSurrogateSelector : ISurrogateSelector,
ISerializationSurrogate
<ObsoleteAttribute("It's not recommended to use this class. If you need to make different kinds of builds of an assembly binary serialization-compatible, then it is a sign that binary serialization is used in an insecure way.")>
Public Class NameInvariantSurrogateSelector
Implements ISurrogateSelector, ISerializationSurrogate
[ObsoleteAttribute(L"It's not recommended to use this class. If you need to make different kinds of builds of an assembly binary serialization-compatible, then it is a sign that binary serialization is used in an insecure way.")]
public ref class NameInvariantSurrogateSelector : ISurrogateSelector,
ISerializationSurrogate
[<ObsoleteAttribute("It's not recommended to use this class. If you need to make different kinds of builds of an assembly binary serialization-compatible, then it is a sign that binary serialization is used in an insecure way.")>]
type NameInvariantSurrogateSelector =
class
interface ISurrogateSelector
interface ISerializationSurrogate
end
- Inheritance
- Object NameInvariantSurrogateSelector
- Implements
- ISerializationSurrogate, ISurrogateSelector
If you deserialize a stream from an untrusted source make sure that you set the SafeMode property,
which prevents supporting non-serializable types. Please note though that you cannot use this class for BinarySerializationFormatter when the SafeMode flag
is enabled in its Options property, even if the SafeMode property is set to .
See also the security notes at the Remarks section of the BinarySerializationFormatter class for more details.
You can use this surrogate selector for any non-primitive types that do not implement ISerializable interface.
Versioning by this surrogate selector can be accomplished only if new fields are always defined after the old ones on every level of the hierarchy.
You might want to use also the
WeakAssemblySerializationBinder class to ignore version information of assemblies on deserialization.
Please note that this surrogate selector does not identify field names on deserialization so reordering members may corrupt or fail deserialization.
ChainSelector |
Specifies the next ISurrogateSelector for surrogates to examine if the current instance does not have a surrogate for the specified type and assembly in the specified context.
|
GetNextSelector |
Returns the next surrogate selector in the chain.
|
GetSurrogate |
Finds the surrogate that represents the specified object's type, starting with the specified surrogate selector for the specified serialization context.
|