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

Fix ResponseStreamWrapper.Write to wait on async call #7

Closed atifaziz closed 5 years ago

atifaziz commented 5 years ago

ResponseStreamWrapper.Write, which internally calls the async method InjectLiveReloadScriptAsync, never waits for it to complete and so could lead to corruption of sorts. This PR fixes that by blocking until the asynchronous operation completes.

I seriously doubted if ASP.NET Core ever calls the synchronous methods a Stream so this bug may never show up but I noticed the issue on passing and thought why take the risk of having it wrong?