CNA-BUG-174: LocalNetworkGamer::ReceiveData(PacketReader&, NetworkGamer*&) always returns 0 instead of the packet size
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
The PacketReader overload keeps FNA's never-updated length variable and returns 0 whether or not a packet was received, where XNA returns the number of bytes read.
- Identifier
CNA-BUG-174- Category
- Bug
- Subsystem
- Networking & gamer services
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Severity
- Low (a triage suggestion, not a project priority)
- Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- LocalNetworkGamer::ReceiveData(PacketReader&, NetworkGamer*&)
Expected behaviour
XNA 4.0's ReceiveData(PacketReader, out NetworkGamer) (decompiled) resizes the reader to the next packet and returns ReceiveData(data.ByteArray, 0, out sender), the received byte count; the byte-array overloads in CNA also return the count.
Actual behaviour at TARGET
LocalNetworkGamer.cpp declares uint32_t len = 0, never updates it and returns it. LocalNetworkGamer.hpp documents 'Always 0 when a packet was available; 0 when none was, too' as a preserved FNA quirk. LocalNetworkGamerTests.cpp's ReceiveDataIntoPacketReaderReturnsZero exercises only an empty queue (where 0 is also XNA's result), so no test pins the always-zero return for a received packet. Code that loops while (gamer.ReceiveData(reader, sender) > 0) never reads a packet. The reader-resize half of the same overload is CNA-BUG-171.
Source locations
modules/net/src/Xna/LocalNetworkGamer.cpp— ReceiveData(PacketReader&, NetworkGamer*&): uint32_t len = 0 returnedmodules/net/include/Microsoft/Xna/Framework/Net/LocalNetworkGamer.hpp— documents the preserved zero returnmodules/net/tests/Microsoft/Xna/Framework/Net/LocalNetworkGamerTests.cpp— ReceiveDataIntoPacketReaderReturnsZero pins it
Evidence
Checked by reading at 009d40f5 against the decompiled XNA 4.0 LocalNetworkGamer.ReceiveData; not executed. CNA keeps the value deliberately for FNA parity; this entry applies CNA's rule that XNA wins where the two disagree.
Independent re-verification: Checked by reading at 009d40f5 against the decompiled XNA 4.0 LocalNetworkGamer.ReceiveData and CNA's own CLAUDE.md rule that XNA wins where FNA and XNA disagree; not executed. The named test calls the overload with nothing queued, so it never reaches the packet path.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
LocalNetworkGamerTests.cpp asserts the zero return.
Regression test
Change the test to expect the packet size, and return it (together with the reader resize of CNA-BUG-171).
Blast radius
Games that use the return value of the PacketReader overload; most XNA samples test IsDataAvailable instead and are unaffected.
Workaround
Use IsDataAvailable and the reader's contents, or the byte-array overload.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- Internals
- Network session internals: the pump
- Known issues
- Bug index