@@ -17,14 +17,22 @@ internal sealed class TestApplicationsEventHandlers(TerminalTestReporter output)
17
17
18
18
public void OnHandshakeReceived ( object sender , HandshakeArgs args )
19
19
{
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
+
20
29
var hostType = args . Handshake . Properties [ HandshakeMessagePropertyNames . HostType ] ;
21
30
// https://github.com/microsoft/testfx/blob/2a9a353ec2bb4ce403f72e8ba1f29e01e7cf1fd4/src/Platform/Microsoft.Testing.Platform/Hosts/CommonTestHost.cs#L87-L97
22
31
if ( hostType == "TestHost" )
23
32
{
24
33
// AssemblyRunStarted counts "retry count", and writes to terminal "(Try <number-of-try>) Running tests from <assembly>"
25
34
// 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)
26
35
// 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 ;
28
36
var executionId = args . Handshake . Properties [ HandshakeMessagePropertyNames . ExecutionId ] ;
29
37
var instanceId = args . Handshake . Properties [ HandshakeMessagePropertyNames . InstanceId ] ;
30
38
var arch = args . Handshake . Properties [ HandshakeMessagePropertyNames . Architecture ] ? . ToLower ( ) ;
0 commit comments