Skip to content

Releases

3.2.0

Choose a tag to compare

@Mercurial Mercurial released this 03 Dec 02:42
3.2.0
13f9cea

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.0 only. netstandard2.0 (.NETStandard,Version=v2.0), net8.0, net9.0 and net10.0 are dropped.
  • CborConverterProviderBase.CreateConverter and CreateGenericConverter are now static. Recompile classes that derive from it; this. and base. calls to them become plain calls.
  • RawString.Empty is now read-only.
  • Invalid UTF-8 in a definite-length text string throws CborException, whose Offset is the string's position.
  • Malformed breaks and the reserved headers 0xFD and 0xFE are 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

  • LowerCaseNamingConvention and UpperCaseNamingConvention ignore the current culture. Under tr-TR, Id gave ıd and id gave İD; they now give id and ID.
  • A constructor parameter binds to its field or property by an ordinal, case-insensitive name match. Under tr-TR, a parameter id now binds to Id; names that differ only by a character the culture ignores, such as a soft hyphen, no longer bind.
  • Converting a long of 0 or more to CborNegative still throws ArgumentOutOfRangeException with ParamName value, now with the runtime's standard message, which includes the value.
  • ByteBufferWriter.Advance, GetMemory and GetSpan with a negative argument throw ArgumentException with ParamName count or sizeHint (it was null) and a message saying the value must not be negative (it was the parameter name).
  • Calls to the obsolete ReadOnlySequenceExtensions.GetSpan now 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.DeserializeMultipleAsync and the Stream extensions ReadAsync and ReadAndGivePreciseLengthAsync read a seekable stream from its current position to its end; before, one read could stop short.
  • Cbor.ReadNextItemAsync consumes 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.
  • SkipDataItem skips nested tags, simple-value payloads and indefinite-length text strings correctly.

Trimming and AOT

  • CborReader, CborWriter, CborReaderBookmark, CborException, CountingBufferWriter and ByteBufferWriter carry 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) or EnableAotAnalyzer (the IL3xxx) on, which IsAotCompatible, PublishTrimmed and PublishAot also turn on, now gets the warnings below. No signature changes, and nothing changes at run time.
    • IL2026 and IL3050 at every call to a Cbor method, at new CborOptions() and at CborOptions.Default.
    • IL2026 and IL3050 at the public constructors (and any static member) of the converter providers, SerializationRegistry, CborConverterRegistry, ObjectMappingRegistry, ObjectMapping<T>, MemberMapping<T>, CreatorMapping, ImmutableCollectionConverter and ImmutableDictionaryConverter.
    • IL2026 and IL3050 at calls to Apply<T> on IObjectMappingConvention and on the two built-in conventions.
    • IL2026 at the constructors of ObjectConverter<T> and DiscriminatorConventionRegistry.
    • IL3050 at the constructors of EnumConverter<T> and CborValueConverter.
    • In SAIB.Cbor.Util: IL3050 at ConstructorInfoExtensions.CreateDelegate(ConstructorInfo) and MethodInfoExtensions.CreateDelegate, and IL2026 at TypeExtensions.GetDefaultValue.
    • The object model: IL3050 at its constructors (such as new CborObject()) and at the static methods of CborValueConvert, and IL2026 as well at CborValueConvert.ToValue(object, CborOptions?), CborObject.FromObject<T>, CborObject.ToObject<T>, CborArray.FromCollection<T> and CborArray.ToCollection<T>.
    • None at the implicit conversions (CborValue v = 5). dynamic member access warns from the C# runtime binder, as before.
    • A class that derives from CborConverterProviderBase gets 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 through ObjectMappingConventionRegistry.RegisterConvention, gets IL2046 and IL3051 unless it carries both [RequiresUnreferencedCode] and [RequiresDynamicCode].
  • 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.
  • CountingBufferWriter counts encoded bytes in reusable scratch memory; Reset keeps its grown capacity.
  • RawString has == and !=.
  • The package holds the README and SourceLink; symbols ship as a .snupkg.

2.0.0

Choose a tag to compare

@Mercurial Mercurial released this 02 Mar 07:39
9f93a06

Breaking Changes

  • All namespaces renamed from Dahomey.Cbor to SAIB.Cbor
  • Project, solution, and directory names updated to match

What's Changed

  • Add ReadByteStringToArray() for efficient byte array reads
  • Full rebrand from Dahomey.Cbor to SAIB.Cbor
  • Updated README with new package info and credit to original project

Migration

Replace all using Dahomey.Cbor with using SAIB.Cbor in your code.

1.26.2

Choose a tag to compare

@Mercurial Mercurial released this 02 Mar 07:26
b9bee2a

What's Changed

  • Add support for indefinite-length byte strings (RFC 8949)
  • Use ArrayPool for efficient memory allocation during indefinite-length reads
  • Add unit tests for indefinite-length byte string parsing
  • Rebrand NuGet package to SAIB.Cbor