Lab 8: Clean Sonar issues and prepare gated build#20
Merged
Conversation
- fill empty while-loop body in Program.cs - seal UdpTimedSender and add _disposed guard - call GC.SuppressFinalize in UdpTimedSender.Dispose
… security hotspot
- move IUdpClient into NetSdrClientApp.Networking namespace - dispose _cts before reassignment in TcpClientWrapper (L43) - dispose _cts before reassignment in UdpClientWrapper (L26) - add Equals override to UdpClientWrapper alongside GetHashCode
- declare responseTaskSource as nullable (TaskCompletionSource<byte[]>?) - change SendTcpRequest return type to Task<byte[]?> - assign null to nullable responseTaskSource on message received - remove unused ex variable in UdpClientWrapper catch block
- wrap 2 independent Assert blocks in EnterMultipleScope - replace 2 IEnumerable Count() calls with ToArray() and Has.Length.EqualTo
- declare _cts as nullable - dispose _cts before nulling in Disconnect - guard null _cts in while loop condition - use Memory<byte> overloads for ReadAsync and WriteAsync - remove unused ex in OperationCanceledException catch
…lientWrapper - add Connected and Disconnect tests for TcpClientWrapper - add Equals with different type and StartListeningAsync/StopListening tests for UdpClientWrapper
…erage - add Connect/SendMessage/Disconnect happy path test - add MessageReceived event test when server sends data - add listener loop exception handling test when server closes connection
- replace Is.False with Is.EqualTo(false) in Equals_DifferentType_ReturnsFalse - add assertion to StartListeningAsync_ThenStop_DisposesCtsProperly
…tType_ReturnsFalse
|
Owner
Author
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.








What's changed
Maintainability / Code Smells
EchoTcpServerProgram.csUdpTimedSender_disposedguard and callGC.SuppressFinalizeinDisposeIUdpClientinto theNetSdrClientApp.NetworkingnamespaceNetSdrClient,UdpClientWrapper, andTcpClientWrapper_ctsin the receive loopMemory<byte>overloads forReadAsyncandWriteAsyncNetSdrMessageHelperTestsAssert.EnterMultipleScopeCount()checks with array length assertionsStartListeningAsync_ThenStop_DisposesCtsProperlyEquals_DifferentType_ReturnsFalseReliability Issues
_ctsbefore reassignment inTcpClientWrapper_ctsbefore reassignment inUdpClientWrapper_ctsbefore clearing it inDisconnectEqualsoverride toUdpClientWrapperalongsideGetHashCodeSecurity Hotspot
UdpClientWrapper.GetHashCodewithHashCode.CombineTests
UdpClientWrapper.EqualsUdpClientWrapper.GetHashCodeRisk notes
UdpClientWrapperequality/hash behavior was updated, so equality-related behavior is covered by new testsHow to verify