Skip to content

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

Merged
gewarren merged 11 commits into
mainfrom
copilot/breaking-change-cbor-reader-writer
Jun 17, 2026
Merged

Breaking change docs: CborReader/CborWriter enforce default maximum nesting depth (.NET 11)#54360
gewarren merged 11 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/core-libraries/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 Core .NET libraries
  • docs/core/compatibility/toc.yml — adds entry under .NET 11 Core .NET libraries
  • Article updates — uses xrefs for the first mentions of CborReader and CborWriter, and refines the rationale wording to match repo style guidance

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);

You cannot use an AppContext switch to restore the previous unlimited-depth behavior.


Internal previews

📄 File 🔗 Preview link
docs/core/compatibility/11.md Breaking changes in .NET 11
docs/core/compatibility/core-libraries/11/cbor-max-depth.md CborReader and CborWriter enforce a default maximum nesting depth
docs/core/compatibility/toc.yml docs/core/compatibility/toc

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
@gewarren gewarren requested a review from Copilot June 15, 2026 19:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents a .NET 11 Preview 5 breaking change in System.Formats.Cbor where CborReader and CborWriter now enforce default maximum nesting depths, and explains how to configure higher limits with the new options types.

Changes:

  • Adds a new breaking-change article describing previous vs. new max-depth behavior, exceptions thrown, and mitigation via CborReaderOptions/CborWriterOptions.
  • Adds the new breaking change to the .NET 11 compatibility index page under Extensions.
  • Adds the new article to the compatibility TOC under .NET 11 > Extensions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
docs/core/compatibility/extensions/11/cbor-max-depth.md New breaking-change article documenting default max depth enforcement and configuration guidance.
docs/core/compatibility/11.md Adds the new breaking change entry to the .NET 11 list under Extensions.
docs/core/compatibility/toc.yml Adds TOC navigation entry for the new .NET 11 Extensions breaking change article.

Comment thread docs/core/compatibility/extensions/11/cbor-max-depth.md
Comment thread docs/core/compatibility/core-libraries/11/cbor-max-depth.md
Comment thread docs/core/compatibility/extensions/11/cbor-max-depth.md Outdated
Copilot AI requested a review from gewarren June 15, 2026 19:34
Comment thread docs/core/compatibility/core-libraries/11/cbor-max-depth.md Outdated
@gewarren gewarren marked this pull request as ready for review June 15, 2026 19:42
@gewarren gewarren requested a review from a team as a code owner June 15, 2026 19:42
Comment thread docs/core/compatibility/core-libraries/11/cbor-max-depth.md Outdated
@gewarren gewarren requested a review from a team June 15, 2026 23:46

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Let's :shipit:

@gewarren gewarren merged commit 63f85f5 into main Jun 17, 2026
11 checks passed
@gewarren gewarren deleted the copilot/breaking-change-cbor-reader-writer branch June 17, 2026 20:17
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.

[Breaking change]: CborReader and CborWriter enforce a default maximum nesting depth

4 participants