Closed ladeak closed 5 years ago
@ladeak, thanks for reporting this. We don't (yet) support .Net Core 3, and haven't done any testing on it. This seems like a great work item for us to take up in our 4.7 Milestone, which starts in November and ends in mid December.
In the mean time, if you would like to submit a PR to fix this I would be more than happy to look at it. The only real concern is the fix needs to be back-compatable with NetCore21.
Version
4.5.2
Describe the bug
HttpHelper throws an exception on .net core 3.0, because of reading the request body sync.
To Reproduce
Create a .net core 3.0 based chatbot, and send a message to it.
Expected behavior
It shall now throw exception in ProcessAsync method, because it shall use async read.
Additional context
Related to
https://github.com/aspnet/AspNetCore/issues/7644
Exception
System.InvalidOperationException: 'Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.'
Stacktrace:
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.IO.StreamReader.ReadBuffer(Spand3.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at IotProcessor.CoreBot.Controllers.BotController.d 3.MoveNext() in ...\source\repos\IotProcessor\BotService\Controllers\BotController.cs:line 38
1 userBuffer, Boolean& readToUserBuffer) at System.IO.StreamReader.ReadSpan(Span
1 buffer) at System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count) at Newtonsoft.Json.JsonTextReader.ReadData(Boolean append, Int32 charsRequired) at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonReader.ReadAndMoveToContent() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader) at Microsoft.Bot.Builder.Integration.AspNet.Core.HttpHelper.ReadRequest(HttpRequest request) at Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter.[bug]