Skip to content

Breaking change docs: CborReader/CborWriter enforce default maximum nesting depth (.NET 11)#54360

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/breaking-change-cbor-reader-writer
Draft

Breaking change docs: CborReader/CborWriter enforce default maximum nesting depth (.NET 11)#54360
Copilot wants to merge 3 commits into
mainfrom
copilot/breaking-change-cbor-reader-writer

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Documents the .NET 11 Preview 5 breaking change where CborReader and CborWriter now enforce maximum nesting depths by default (64 and 1000, respectively), throwing CborContentException and InvalidOperationException when exceeded.

Changes

  • New article docs/core/compatibility/extensions/11/cbor-max-depth.md — covers previous/new behavior, affected APIs, and how to configure a higher limit via the new CborReaderOptions/CborWriterOptions types
  • docs/core/compatibility/11.md — adds entry under Extensions
  • docs/core/compatibility/toc.yml — adds entry under .NET 11 Extensions

Key callout documented

Unlike Utf8JsonReader/Utf8JsonWriter, MaxDepth = 0 means no nesting allowed (not "use the runtime default"). Users who need deeper nesting must opt in explicitly:

var options = new CborReaderOptions { MaxDepth = 256 };
var reader = new CborReader(data, options);

var writerOptions = new CborWriterOptions { MaxDepth = 2000 };
var writer = new CborWriter(writerOptions);

There is no AppContext switch to restore unlimited-depth behavior.

Copilot AI requested review from Copilot and removed request for Copilot June 12, 2026 00:55
Copilot AI requested review from Copilot and removed request for Copilot June 12, 2026 00:58
Copilot AI requested review from Copilot and removed request for Copilot June 12, 2026 00:58
Copilot AI changed the title [WIP] Enforce maximum nesting depth for CborReader and CborWriter Breaking change docs: CborReader/CborWriter enforce default maximum nesting depth (.NET 11) Jun 12, 2026
Copilot AI requested a review from gewarren June 12, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants