WeakAssemblySerializationBinder Class
Provides a
SerializationBinder instance for
IFormatter implementations that can ignore version and token information
of stored assembly name. This makes possible to deserialize objects stored in different version of the original assembly.
It also can make any
IFormatter safe in terms of prohibiting loading assemblies during the deserialization if the
SafeMode
property is
.
Namespace: KGySoft.Serialization.BinaryAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public sealed class WeakAssemblySerializationBinder : SerializationBinder,
ISerializationBinder
Public NotInheritable Class WeakAssemblySerializationBinder
Inherits SerializationBinder
Implements ISerializationBinder
public ref class WeakAssemblySerializationBinder sealed : public SerializationBinder,
ISerializationBinder
[<SealedAttribute>]
type WeakAssemblySerializationBinder =
class
inherit SerializationBinder
interface ISerializationBinder
end
- Inheritance
- Object SerializationBinder WeakAssemblySerializationBinder
- Implements
- ISerializationBinder
If a deserialization stream may come from an untrusted source, then make sure to set the SafeMode property
to to prevent loading assemblies when resolving 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 the security notes at the Remarks section of the BinarySerializationFormatter class for more details.
This binder does not use exact type mapping just tries to resolve type information automatically.
To customize type mapping or use a custom resolve logic you can use the
ForwardedTypesSerializationBinder
or
CustomSerializationBinder classes, respectively.
The WeakAssemblySerializationBinder class allows resolving type information by weak assembly identity,
or by completely ignoring assembly information (if IgnoreAssemblyNameOnResolve property is .)
It also makes possible to prevent loading assembles during deserialization if the SafeMode property is .
If WeakAssemblySerializationBinder is used on serialization, then it can omit assembly information from the serialization stream
if the OmitAssemblyNameOnSerialize property is .
IgnoreAssemblyNameOnResolve |
Gets or sets whether an existing assembly name is allowed to be completely ignored on deserialization.
Default value: .
|
OmitAssemblyNameOnSerialize |
Gets or sets whether assembly name should be completely omitted on serialization.
Default value: .
|
SafeMode |
Gets or sets whether loading assemblies is prohibited on deserialization.
Default value: .
|