Skip to content

fix: Harden error handling - #4161

Open
EmandM wants to merge 5 commits into
develop-3.x.xfrom
fix/error-handling
Open

EmandM wants to merge 5 commits into
develop-3.x.xfrom
fix/error-handling

Conversation

@EmandM

@EmandM EmandM commented Sep 15, 2026

Copy link
Copy Markdown
Member

Purpose of this PR

Ensure as many callbacks as possible are wrapped in try/catch blocks to avoid user generated errors throwing into internal netcode functionality.

Jira ticket

Reported internally.

Changelog

  • Fixed: Ensures all callbacks are wrapped with exception handling to avoid silent errors.

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.

Up-port

not needed

Backports

Might be worth a backport?

@EmandM
EmandM requested a review from a team as a code owner September 15, 2026 22:21
@u-pr

u-pr Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

⚠️ Some settings were ignored in '.pr_agent.toml (repository root)' repo settings

Check the configuration's TOML syntax, permitted settings, and size limit. See the error below.


Error message:
Ignored prohibited settings: github_app.handle_pr_actions. Permitted settings were applied.

Configuration content:
# This is the configuration for the u-pr bot
# https://github.cds.internal.unity3d.com/unity/u-pr
# For configuration of this file:
# https://developer.portal.internal.unity.com/catalog/default/component/u-pr/docs/configuration/automatic_runs/

[github_app]
handle_pr_actions = ['opened', 'ready_for_review']  # PR events that auto-run pr_commands
pr_commands       = ["/harness-review"]             # what runs on those events
reviewer_commands = ["/harness-review"]             # what runs when @u-pr is added as reviewer

@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

Needs changes

This broadly hardens user callback execution, but several exception paths change observable ownership and visibility behavior, and some shared exception boundaries still suppress later lifecycle notifications.

Reviewed commit c319570

🤖 Helpful? 👍/👎

@EmandM
EmandM requested a review from jabbacakes as a code owner September 21, 2026 19:58
@codecov-github-com

codecov-github-com Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 43.34140% with 234 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...cts/Runtime/SceneManagement/NetworkSceneManager.cs 48.35% 47 Missing ⚠️
....netcode.gameobjects/Runtime/Core/NetworkObject.cs 49.23% 33 Missing ⚠️
...ime/Components/Helpers/UnifiedUpdateConnections.cs 0.00% 28 Missing ⚠️
...tcode.gameobjects/Runtime/Core/NetworkBehaviour.cs 34.28% 23 Missing ⚠️
...cts/Runtime/Connection/NetworkConnectionManager.cs 37.93% 18 Missing ⚠️
...time/SceneManagement/DefaultSceneManagerHandler.cs 0.00% 18 Missing ⚠️
...ameobjects/Runtime/Spawning/NetworkSpawnManager.cs 18.75% 13 Missing ⚠️
...objects/Runtime/NetworkVariable/NetworkVariable.cs 42.85% 12 Missing ⚠️
...netcode.gameobjects/Runtime/Core/NetworkManager.cs 79.59% 10 Missing ⚠️
...meobjects/Runtime/Spawning/NetworkPrefabHandler.cs 42.85% 8 Missing ⚠️
... and 5 more
@@                Coverage Diff                @@
##           develop-3.x.x    #4161      +/-   ##
=================================================
- Coverage          76.91%   76.33%   -0.59%     
=================================================
  Files                159      159              
  Lines              27603    27953     +350     
=================================================
+ Hits               21230    21337     +107     
- Misses              6373     6616     +243     
Flag Coverage Δ
NGOv2_project_testproject_ubuntu 75.37% <43.34%> (-0.60%) ⬇️

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

Files with missing lines Coverage Δ
.../Runtime/Components/Helpers/ComponentController.cs 39.08% <100.00%> (+0.70%) ⬆️
...me/Messaging/Messages/ConnectionApprovedMessage.cs 67.35% <100.00%> (ø)
...cts/Runtime/NetworkVariable/NetworkVariableBase.cs 87.50% <ø> (ø)
...cts/Runtime/Components/Helpers/UnifiedBootstrap.cs 38.46% <42.85%> (-0.43%) ⬇️
...time/NetworkVariable/AnticipatedNetworkVariable.cs 75.14% <42.85%> (-1.51%) ⬇️
...Runtime/NetworkVariable/Collections/NetworkList.cs 78.93% <42.85%> (-0.83%) ⬇️
...gameobjects/Runtime/Transports/NetworkTransport.cs 77.08% <42.85%> (-6.25%) ⬇️
...meobjects/Runtime/Spawning/NetworkPrefabHandler.cs 64.95% <42.85%> (-1.71%) ⬇️
...e.gameobjects/Runtime/Timing/AnticipationSystem.cs 87.50% <42.85%> (-12.50%) ⬇️
...netcode.gameobjects/Runtime/Core/NetworkManager.cs 74.95% <79.59%> (-0.08%) ⬇️
... and 8 more
Components Coverage Δ
com.unity.netcode.gameobjects 76.33% <41.37%> (-0.59%) ⬇️

ℹ️ Need help interpreting these results?

This branch has not been deployed

No deployments
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.

3 participants