RickStrahl / Westwind.AspnetCore.LiveReload

ASP.NET Core Live Reload Middleware that monitors file changes in your project and automatically reloads the browser's active page
Other
473 stars 42 forks source link

asp.net core 3.0 preview 9 #13

Closed dotnetshadow closed 5 years ago

dotnetshadow commented 5 years ago

Hi there,

I recently upgraded to asp.net core 3.0 preview 9 and encountered the following error while using LiveReload

An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.Flush()
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionBody.Flush()
   at Westwind.AspnetCore.LiveReload.ResponseStreamWrapper.Flush()
   at System.IO.Stream.<>c.<FlushAsync>b__40_0(Object state)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executio
RickStrahl commented 5 years ago

Yes is see it too. Looks like there's been a change in how data is written in 3.0 and it's much stricter in terms of its Async usage. The Flush didn't actually come from my code but because the overrides didn't have an async version the non-async code got triggered.

It turns out this bug caused a number of other problems which are described in this ASP.NET Core Github issue:

https://github.com/aspnet/AspNetCore/issues/14056

Nasty little issue. In any case the updated code now works properly in .NET Core 3.0 and as a side effect fixes a couple of other side effects related to content-length errors.

dotnetshadow commented 5 years ago

@RickStrahl that's awesome, I'll wait until it's on the nuget feed to test out

RickStrahl commented 5 years ago

I had updated the package yesterday, but it got rejected due to a new code signing certificate I've used. Fixed the Nuget registration and should be up shortly.