dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.3k stars 9.97k forks source link

aspnetcore app.UseWebpackDevMiddleware throws System.OperationCanceledException #26587

Closed justinushermawan closed 4 years ago

justinushermawan commented 4 years ago

I'm using a Webpack Middleware from Microsoft.AspNetCore.SpaServices.Webpack to build an aspnetcore app with VanillaJS for the client app and using Webpack module bundler for it. Here is my Startup's Configure(...):

if (env.IsDevelopment())
{
    app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
    {
        ProjectPath = Path.Combine(Directory.GetCurrentDirectory(), "ClientApp"),
        HotModuleReplacement = true
    });

    app.UseDeveloperExceptionPage();
}

But every time I cancel the running app with CTRL-C, it throws an exception like this:

Unhandled exception. System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at Microsoft.Extensions.Hosting.Internal.Host.StopAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.WaitForShutdownAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Revolt.Program.Main(String[] args) in C:\Workspace\revolt\Revolt\Program.cs:line 16

What's wrong here?

mkArtakMSFT commented 4 years ago

Thanks for contacting us. We have obsoleted the WebpackDevMiddleware in 3.0. We do not plan to make any changes to it, unless there are any security concerns. This looks like a non-major bug we don't plan to address.