Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ObjectDisposedException on Unity Transport shutdown [backport] #3152

Merged

Conversation

EmandM
Copy link
Contributor

@EmandM EmandM commented Dec 4, 2024

Ensures that UnityTransport is marked as Disconnected after shutting down. This ensures that no exceptions are thrown when trying to use the transport after it has been shut down.

This PR also adds a warning message when a UnityTransport has a NetworkManager and UnityTransport.Shutdown() has been called outside of NetworkManager.Shutdown() as shutting down the UnityTransport directly will result in unexpected disconnection behaviour (connected clients will not get Disconnect events and pending messages may be dropped).

fix: #3118

Changelog

  • Fixed: Issue where an ObjectDisposedException was thrown when calling NetworkManager.Shutdown() after calling UnityTransport.Shutdown()

Testing and Documentation

  • Unit tests have been added to UnityTransportTests to ensure exceptions are not thrown when using the transport after shutting it down.
  • No documentation changes or additions were necessary.

@EmandM EmandM requested a review from a team as a code owner December 4, 2024 22:37
@EmandM EmandM requested a review from a team as a code owner December 5, 2024 15:29
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:godmode:

@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) December 10, 2024 02:44
@NoelStephensUnity NoelStephensUnity merged commit 06a83bd into develop Dec 10, 2024
24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/exception_on_transport_shutdown_backport branch December 10, 2024 03:19
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.

ObjectDisposedException is thrown when disconnecting as a host, when at least 1 client is connected.
3 participants