@@ -17,14 +17,22 @@ internal sealed class TestApplicationsEventHandlers(TerminalTestReporter output)
1717
1818 public void OnHandshakeReceived ( object sender , HandshakeArgs args )
1919 {
20+ var testApplication = ( TestApplication ) sender ;
21+ // Today, it's 1.0.0 in MTP.
22+ // https://github.com/microsoft/testfx/blob/516eebb3c9b7e81eb2677c00b3d0b7867d8acb33/src/Platform/Microsoft.Testing.Platform/ServerMode/DotnetTest/IPC/Constants.cs#L40
23+ var supportedProtocolVersions = args . Handshake . Properties [ HandshakeMessagePropertyNames . SupportedProtocolVersions ] ;
24+ if ( supportedProtocolVersions != "1.0.0" && ! supportedProtocolVersions . Split ( ';' ) . Contains ( "1.0.0" ) )
25+ {
26+ _output . HandshakeFailure ( testApplication . Module . TargetPath , string . Empty , ExitCode . GenericFailure , $ "Supported protocol versions '{ supportedProtocolVersions } ' doesn't include '1.0.0' which is not supported by the current .NET SDK.", string . Empty ) ;
27+ }
28+
2029 var hostType = args . Handshake . Properties [ HandshakeMessagePropertyNames . HostType ] ;
2130 // https://github.com/microsoft/testfx/blob/2a9a353ec2bb4ce403f72e8ba1f29e01e7cf1fd4/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs#L87-L97
2231 if ( hostType == "TestHost" )
2332 {
2433 // AssemblyRunStarted counts "retry count", and writes to terminal "(Try <number-of-try>) Running tests from <assembly>"
2534 // So, we want to call it only for test host, and not for test host controller (or orchestrator, if in future it will handshake as well)
2635 // Calling it for both test host and test host controllers means we will count retries incorrectly, and will messages twice.
27- var testApplication = ( TestApplication ) sender ;
2836 var executionId = args . Handshake . Properties [ HandshakeMessagePropertyNames . ExecutionId ] ;
2937 var instanceId = args . Handshake . Properties [ HandshakeMessagePropertyNames . InstanceId ] ;
3038 var arch = args . Handshake . Properties [ HandshakeMessagePropertyNames . Architecture ] ? . ToLower ( ) ;
0 commit comments