Fix ordering of thread clean-up on dispose to fix tests in newer .net versions #63
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.
When attempting to update a consuming application to a newer version of dotnet (specifically .NET 6), certain Hazel related tests would fail.
Turned out that, on dispose,
ThreadLimitedUdpConnectionListenerwould clean up threads out of order, causing the chance of an unhandled socket exception (ie. Shutdown called on the socket before a thread tries to use the socket). It's a mystery why the tests would by-chance work previously all the time and then start to fail consistently post dotnet upgrade.Likewise, upgrading Hazel to .NET 6 also caused tests to fail. So that was used as a test case for testing the fixes made.