Repository navigation
Release notes
3.2.0
The first release since 2.0.0. Versions 3.0.0 and 3.1.0 were never published; their changes are listed here.
Breaking changes
- SAIB.Cbor targets
net11.0only. netstandard2.0 (.NETStandard,Version=v2.0),net8.0,net9.0andnet10.0are dropped. CborConverterProviderBase.CreateConverterandCreateGenericConverterare nowstatic. Recompile classes that derive from it;this.andbase.calls to them become plain calls.RawString.Emptyis now read-only.- Invalid UTF-8 in a definite-length text string throws
CborException, whoseOffsetis the string's position. - Malformed breaks and the reserved headers
0xFDand0xFEare rejected. - An indefinite-length string is rejected when a chunk is of another major type or is itself indefinite-length; each text chunk must be valid UTF-8 on its own.
Behaviour changes
LowerCaseNamingConventionandUpperCaseNamingConventionignore the current culture. Under tr-TR,IdgaveıdandidgaveİD; they now giveidandID.- A constructor parameter binds to its field or property by an ordinal, case-insensitive name match. Under tr-TR, a parameter
idnow binds toId; names that differ only by a character the culture ignores, such as a soft hyphen, no longer bind. - Converting a
longof 0 or more toCborNegativestill throwsArgumentOutOfRangeExceptionwithParamNamevalue, now with the runtime's standard message, which includes the value. ByteBufferWriter.Advance,GetMemoryandGetSpanwith a negative argument throwArgumentExceptionwithParamNamecountorsizeHint(it was null) and a message saying the value must not be negative (it was the parameter name).- Calls to the obsolete
ReadOnlySequenceExtensions.GetSpannow warn CS0618 with "Copies a multi-segment sequence into a new array; read the sequence's segments instead." (they warned CS0612 with no message). Cbor.DeserializeAsync,Cbor.DeserializeMultipleAsyncand theStreamextensionsReadAsyncandReadAndGivePreciseLengthAsyncread a seekable stream from its current position to its end; before, one read could stop short.Cbor.ReadNextItemAsyncconsumes only the item it returns, so the bytes after it are available to the next read without waiting for more data. Invalid UTF-8 in a definite-length text string throws at once instead of waiting.SkipDataItemskips nested tags, simple-value payloads and indefinite-length text strings correctly.
Trimming and AOT
CborReader,CborWriter,CborReaderBookmark,CborException,CountingBufferWriterandByteBufferWritercarry no trimming or AOT requirement. A trimmed app that uses only them publishes with no trim warning and runs. NativeAOT publishing is not covered yet.- A project with
EnableTrimAnalyzer(the IL2xxx warnings) orEnableAotAnalyzer(the IL3xxx) on, whichIsAotCompatible,PublishTrimmedandPublishAotalso turn on, now gets the warnings below. No signature changes, and nothing changes at run time.- IL2026 and IL3050 at every call to a
Cbormethod, atnew CborOptions()and atCborOptions.Default. - IL2026 and IL3050 at the public constructors (and any static member) of the converter providers,
SerializationRegistry,CborConverterRegistry,ObjectMappingRegistry,ObjectMapping<T>,MemberMapping<T>,CreatorMapping,ImmutableCollectionConverterandImmutableDictionaryConverter. - IL2026 and IL3050 at calls to
Apply<T>onIObjectMappingConventionand on the two built-in conventions. - IL2026 at the constructors of
ObjectConverter<T>andDiscriminatorConventionRegistry. - IL3050 at the constructors of
EnumConverter<T>andCborValueConverter. - In
SAIB.Cbor.Util: IL3050 atConstructorInfoExtensions.CreateDelegate(ConstructorInfo)andMethodInfoExtensions.CreateDelegate, and IL2026 atTypeExtensions.GetDefaultValue. - The object model: IL3050 at its constructors (such as
new CborObject()) and at the static methods ofCborValueConvert, and IL2026 as well atCborValueConvert.ToValue(object, CborOptions?),CborObject.FromObject<T>,CborObject.ToObject<T>,CborArray.FromCollection<T>andCborArray.ToCollection<T>. - None at the implicit conversions (
CborValue v = 5).dynamicmember access warns from the C# runtime binder, as before. - A class that derives from
CborConverterProviderBasegets IL2026 and IL3050 at its declaration. To avoid them, it carries[RequiresUnreferencedCode]and[RequiresDynamicCode]itself, and its own callers then warn. - An
IObjectMappingConvention.Apply<T>implementation, registered throughObjectMappingConventionRegistry.RegisterConvention, gets IL2046 and IL3051 unless it carries both[RequiresUnreferencedCode]and[RequiresDynamicCode].
- IL2026 and IL3050 at every call to a
- Each IL2026 and IL3050 warning ends with one of these texts:
- IL2026: "Maps objects by reflection, which trimming can break. Use CborReader and CborWriter instead."
- IL3050 on serialization and mapping: "Builds generic converters and compiled delegates at run time, which native AOT cannot do. Use CborReader and CborWriter instead."
- IL3050 on the object model and
CborValueConverter: "CborValue types derive from DynamicObject, which needs run-time code generation."
New
CborException.Offset: the reader's byte offset of the error, or -1 when it is not known.CborReader.SkipDataItem(int maxDepth);SkipDataItem()is iterative and has no depth limit.CountingBufferWritercounts encoded bytes in reusable scratch memory;Resetkeeps its grown capacity.RawStringhas==and!=.- The package holds the README and SourceLink; symbols ship as a .snupkg.