diff --git a/eng/Versions.props b/eng/Versions.props index bcede45c76..92dd2b3fcf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ from appending +, which breaks DTAAgent. --> false - 18.8.0 + 18.8.1 release diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/JsonDataSerializer.Stj.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/JsonDataSerializer.Stj.cs index 6d7b2f8dcb..f6c46815ab 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/JsonDataSerializer.Stj.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/JsonDataSerializer.Stj.cs @@ -8,6 +8,7 @@ using System.Text.Encodings.Web; using System.Text.Json; using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Serialization; using Microsoft.VisualStudio.TestPlatform.Common.DataCollection; @@ -74,6 +75,11 @@ static JsonDataSerializer() NumberHandling = JsonNumberHandling.AllowReadingFromString, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, ReferenceHandler = ReferenceHandler.IgnoreCycles, + // Assign an explicit reflection-based resolver. When TypeInfoResolver is null, STJ falls back to + // the implicit default resolver which is disabled when a test project sets + // JsonSerializerIsReflectionEnabledByDefault=false (that switch flows into the testhost runtimeconfig), + // making testhost throw while deserializing the first protocol message and the runner time out. See #16274. + TypeInfoResolver = new DefaultJsonTypeInfoResolver(), }; private static partial (int version, string? messageType) ParseHeaderFromJson(string rawMessage)