diff --git a/src/Microsoft.Kiota.Abstractions.csproj b/src/Microsoft.Kiota.Abstractions.csproj index 080b0b0d..78e8cbc5 100644 --- a/src/Microsoft.Kiota.Abstractions.csproj +++ b/src/Microsoft.Kiota.Abstractions.csproj @@ -6,7 +6,7 @@ © Microsoft Corporation. All rights reserved. Kiota Abstractions Library for dotnet Microsoft - netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0; + netstandard2.0;netstandard2.1;net5.0;net6.0;net7.0;net8.0; latest true http://go.microsoft.com/fwlink/?LinkID=288890 diff --git a/src/serialization/KiotaSerializer.Deserialization.cs b/src/serialization/KiotaSerializer.Deserialization.cs index 6d11c6f9..6f265af8 100644 --- a/src/serialization/KiotaSerializer.Deserialization.cs +++ b/src/serialization/KiotaSerializer.Deserialization.cs @@ -31,7 +31,9 @@ private static Stream GetStreamFromString(string source) { var stream = new MemoryStream(); using var writer = new StreamWriter(stream, Encoding.UTF8, 1024, true); - writer.Write(source); + + // Some clients enforce async stream processing. + writer.WriteAsync(source).GetAwaiter().GetResult(); writer.Flush(); stream.Position = 0; return stream; diff --git a/src/serialization/KiotaSerializer.Serialization.cs b/src/serialization/KiotaSerializer.Serialization.cs index 46a93327..c13d4876 100644 --- a/src/serialization/KiotaSerializer.Serialization.cs +++ b/src/serialization/KiotaSerializer.Serialization.cs @@ -70,7 +70,9 @@ public static string SerializeAsString(string contentType, IEnumerable val private static string GetStringFromStream(Stream stream) { using var reader = new StreamReader(stream); - return reader.ReadToEnd(); + + // Some clients enforce async stream processing. + return reader.ReadToEndAsync().GetAwaiter().GetResult(); } private static ISerializationWriter GetSerializationWriter(string contentType, object value) {