Skip to content

fix: FastBufferWriter growth from a size of 0 (up-port) - #4224

Merged
EmandM merged 4 commits into
develop-3.x.xfrom
fix/fastbufferwriter-grow-from-zero-up-port
Oct 28, 2026
Merged

EmandM merged 4 commits into
develop-3.x.xfrom
fix/fastbufferwriter-grow-from-zero-up-port

Conversation

@NoelStephensUnity

@NoelStephensUnity NoelStephensUnity commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Purpose of this PR

Up-port of #4223.

A growable FastBufferWriter created with a size of 0 now grows on its first write, instead of never returning from it. Grow doubled a capacity of 0, so its loop never reached the required size; growth now starts from at least 1 byte.

Jira ticket

UUM-158589

Changelog

  • Fixed: Issue where a growable FastBufferWriter created with a size of 0 never returned from its first write or TryBeginWrite call that needed the buffer to grow.

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

Up-port

N/A (this is the up-port)

Backports

#4223

🤖 Generated with Claude Code

A growable FastBufferWriter created with a size of 0 never returned from its
first write that needed to grow: Grow doubled a capacity of 0, so its loop never
reached the required size. Growth now starts from at least 1 byte.

UUM-158589

@u-pr u-pr Bot 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.

💡 Harness Review

Ship it

The change correctly allows zero-capacity writers to grow while preserving the existing maximum-capacity checks. I examined the growth and write paths, the regression test, surrounding growth tests, and the changelog; no actionable issues were found.

Reviewed commit 74aadc0

🤖 Helpful? 👍/👎

@codecov-github-com

codecov-github-com Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

@@                Coverage Diff                @@
##           develop-3.x.x    #4224      +/-   ##
=================================================
- Coverage          76.25%   76.20%   -0.06%     
=================================================
  Files                159      159              
  Lines              27538    27576      +38     
=================================================
+ Hits               21000    21013      +13     
- Misses              6538     6563      +25     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 75.27% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...eobjects/Runtime/Serialization/FastBufferWriter.cs 83.16% <100.00%> (ø)

... and 1 file with indirect coverage changes

Components Coverage Δ
com.unity.netcode.gameobjects 76.20% <17.80%> (-0.06%) ⬇️

ℹ️ Need help interpreting these results?

@EmandM
EmandM enabled auto-merge (squash) October 28, 2026 15:58
@EmandM
EmandM merged commit 699cb27 into develop-3.x.x Oct 28, 2026
27 checks passed
@EmandM
EmandM deleted the fix/fastbufferwriter-grow-from-zero-up-port branch October 28, 2026 23:33
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.

4 participants