Skip to content

Fix MTP message handling bugs in TestApplicationHandler#53303

Draft
Evangelink wants to merge 1 commit intomainfrom
fix/test-mtp-message-handling-bugs
Draft

Fix MTP message handling bugs in TestApplicationHandler#53303
Evangelink wants to merge 1 commit intomainfrom
fix/test-mtp-message-handling-bugs

Conversation

@Evangelink
Copy link
Member

Summary

Fixes two bugs in TestApplicationHandler.OnSessionEventReceived:

1. Copy-paste bug: wrong nameof in exception message

The exception for a missing handshake incorrectly used nameof(DiscoveredTestMessages) instead of nameof(TestSessionEvent), producing a misleading error message when a TestSessionEvent is received before handshake.

2. Unknown SessionType values silently ignored

If a new session event type were added to the protocol, it would be silently dropped. Added an else clause to throw ArgumentOutOfRangeException for unknown values, consistent with the pattern used in ToOutcome() which also throws for unrecognized values.

Changes

  • src/Cli/dotnet/Commands/Test/MTP/TestApplicationHandler.cs

- Fix copy-paste bug in OnSessionEventReceived: the exception for missing
  handshake incorrectly used nameof(DiscoveredTestMessages) instead of
  nameof(TestSessionEvent), producing a misleading error message.

- Add else clause to throw ArgumentOutOfRangeException for unknown
  SessionType values, consistent with the pattern used in ToOutcome().
  Previously, unknown session types were silently ignored.
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.

1 participant