Skip to content

Commit 1219b61

Browse files
Fixed compatibility issue with older .net versions
1 parent 46b8293 commit 1219b61

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

libraries/MTConnect.NET-HTTP/Clients/MTConnectHttpClientStream.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ public async Task Run(CancellationToken cancellationToken)
159159
httpRequest.Method = HttpMethod.Get;
160160

161161
using (var response = await _httpClient.SendAsync(httpRequest, HttpCompletionOption.ResponseHeadersRead, stop.Token))
162-
using (var stream = response.Content.ReadAsStream())
162+
#if NET5_0_OR_GREATER
163+
using (var stream = await response.Content.ReadAsStreamAsync(stop.Token))
164+
#else
165+
using (var stream = await response.Content.ReadAsStreamAsync())
166+
#endif
163167
{
164168
var header = new List<byte>();
165169
var headerActive = false;

0 commit comments

Comments
 (0)