Skip to content

fix: Duplicating null NetworkVariables - #3891

Merged
EmandM merged 3 commits into
develop-2.0.0from
fix/null-networkvariable-duplicate
Mar 12, 2026
Merged

EmandM merged 3 commits into
develop-2.0.0from
fix/null-networkvariable-duplicate

Conversation

@EmandM

@EmandM EmandM commented Mar 6, 2026

Copy link
Copy Markdown
Member

Purpose of this PR

Ensure NetworkVariable.Duplicate() doesn't throw an exception if a value is null

Fixes: #3888

Jira ticket

n/a

Changelog

  • Fixed: NestedNetworkVariables initialized with no value no longer throw an error.

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?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Backports

@EmandM
EmandM requested a review from a team as a code owner March 6, 2026 19:29
@EmandM
EmandM enabled auto-merge (squash) March 12, 2026 15:09

@NoelStephensUnity NoelStephensUnity 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.

Nice fix!

@EmandM
EmandM merged commit e0e52f4 into develop-2.0.0 Mar 12, 2026
20 checks passed
@EmandM
EmandM deleted the fix/null-networkvariable-duplicate branch March 12, 2026 18:37
@NoelStephensUnity NoelStephensUnity mentioned this pull request Sep 25, 2026
1 of 6 tasks
NoelStephensUnity added a commit that referenced this pull request Sep 29, 2026
* fix: NGO CoreCLR compatibility

Resolves the NGO CoreCLR test failures and re-enables every test that was disabled for CoreCLR.

UUM-149592 - NetworkVariable serialization codegen not generated for some types
- CoreCLR enforces generic constraints on method instantiations and Mono does not. The ILPP-generated
  NetworkVariableSerializationHelper.InitializeSerialization emitted
  InitializeEqualityChecker_HashSet<HashSet<int>>, which violates T : IEquatable<T>, so CoreCLR rejected
  the whole method and every type registered by that assembly fell back to FallbackSerializer.
- Removed the IEquatable<T> constraint from InitializeEqualityChecker_HashSet<T> and
  EqualityEqualsHashSet<T>. Neither uses it, and #3891 already removed it from the rest of the HashSet
  serialization path to support nested HashSets.
- NetworkBehaviourILPP now validates every emitted serializer and equality checker call against its
  generic constraints, and reports a compile error instead of emitting IL that CoreCLR rejects.

UUM-149591 - integration tests fail to start server and client instances
- Mostly a consequence of UUM-149592: player prefabs with NetworkVariables threw during synchronization,
  so connections never completed.
- PeerDisconnectCallbackTests assumed client ids follow creation order. It now finds the target client
  by id.

UUM-149595 - DAHost player-prefab fetch throws "An item with the same key has already been added"
- NetworkClientAndPlayerObjectTests never cleared m_ChangedPlayerPrefabs between tests and keyed each
  fetched prefab on the last client's id. It now clears the dictionary on teardown and keys on the
  fetching client.

UUM-149597 - unexpected owner write-permission error
- OwnerPermissionHideTests assumed client ids follow creation order. Each object's owner is now chosen
  by client id.

Removed all ENABLE_CORECLR [Explicit] and [UnityCoreClrExplicitDisabled] attributes. Every previously
disabled test passes on CoreCLR (833/833), and the full PlayMode (5423 passed, 0 failed) and EditMode
(1371 passed) suites pass on a trunk CoreCLR editor.

* test: skip BuildTests.BasicBuildTest on Linux editors

BuildPlayer in BasicBuildTest hangs past the job timeout on the ubuntu CI agents, for both 6000.7 and
trunk, while Windows and macOS pass. The same timeouts happen on the develop-3.x.x nightly. Ignored on
Linux editors only, as a temporary measure until the ubuntu CI issue is resolved.
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.

Netcode Issue(?)

3 participants