Contracts: the codec door refuses only a proven family mismatch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d89dd26507
commit
57fdf70c21
2 changed files with 10 additions and 6 deletions
|
|
@ -447,7 +447,9 @@ elements retargets nothing.
|
|||
`[MessagePackObject]` type is read by key even when it is `IEnumerable<T>`; MessagePack
|
||||
writes a keyed type that is also a collection (`ICollection<T>`, `IList`, `IDictionary`)
|
||||
as a collection, so C# refuses such a type at the first encode or decode when it is on the
|
||||
path to an object list. For an
|
||||
path to an object list. A `[DataContract]` type the walk reads as a collection, which
|
||||
MessagePack writes by its members, is refused the same way. A formatter MessagePack's
|
||||
source generator emits is not refused. For an
|
||||
object list, C# refuses at registration a concrete element type that is not keyed and
|
||||
`[MessagePackFormatter]` on any type, collection type or member on the way to the list or on the id
|
||||
member, and refuses at the first encode or decode of the document a formatter
|
||||
|
|
|
|||
|
|
@ -303,11 +303,13 @@ exclusive open of the same lock file exclude each other is not established.
|
|||
type does not claim it (registration refuses a non-public `[Key]` member on the way to
|
||||
an object list, so the private-member formatter writes every id). A value list (`List<float2>`, a list of a non-keyed class) is not on the
|
||||
path, so a resolver may claim it.
|
||||
- The codec also checks, for every type on that path, that `StandardResolver` writes it
|
||||
the way the walk reads it. A type read by key must be written by the object or union
|
||||
resolver; a collection must be written by a collection resolver (generic, immutable or
|
||||
builtin). Otherwise the codec refuses the document on first encode or decode, naming the
|
||||
type. It also refuses, typed, a type MessagePack cannot build a formatter for, and a
|
||||
- The codec also checks, for every type on that path, that `StandardResolver` does not write it
|
||||
against the walk. A type read by key may not be written by the generic collection resolver
|
||||
(a `[MessagePackObject]` class that is also an `ICollection<T>` or dictionary), and a type
|
||||
read as a collection may not be written by the object resolver (a `[DataContract]`
|
||||
enumerable); either is refused on first encode or decode, naming the type. Any other
|
||||
formatter, such as one MessagePack's source generator emits, passes: the walk decides which
|
||||
types carry ids. It also refuses, typed, a type MessagePack cannot build a formatter for, and a
|
||||
resolver that throws while asked about one.
|
||||
- Deserialization runs under untrusted-data security. `CultRecordRef<T>` is a
|
||||
permitted dictionary key, compared by its key string.
|
||||
|
|
|
|||
Loading…
Reference in a new issue