fix: Duplicating null NetworkVariables - #3891
Merged
Merged
Conversation
michalChrobot
approved these changes
Mar 9, 2026
EmandM
enabled auto-merge (squash)
March 12, 2026 15:09
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
Ensure
NetworkVariable.Duplicate()doesn't throw an exception if a value is nullFixes: #3888
Jira ticket
n/a
Changelog
Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes 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