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.45k stars 10.03k forks source link

Now Removed IHttpSendFileFeature leaves Visual Studio without a BrowserLink option for Net6 #34053

Closed jtbrower closed 3 years ago

jtbrower commented 3 years ago

Describe the bug

Please forgive me if my placement of this report should have been logged elsewhere, I am pressed for time, but wanted to share this information for the benefit of others who are excited for the Net6 performance gains and decide to move forward without knowing what they will leave behind.

Simply put, a once obsolete IHttpSendFileFeature API has been completely removed from Net6 leaving Microsoft.VisualStudio.Web.BrowserLink throwing exceptions and unable to be useful for Net6 development as far as I can tell at this time.

It seems that what little related information I could find speaks of using 'dot net watch', but has issues of its own. It does seem from what I read by @danroth27 that there are plans in the works for Net6, I just hope it happens sooner than later since the fall release time is coming quick.

Stack Trace

System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature' from assembly 'Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004989+0x28
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext) in Microsoft.VisualStudio.Web.BrowserLink.dll:token 0x6000004+0x3b
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.Invoke(HttpContext context) in Microsoft.VisualStudio.Web.BrowserLink.dll:token 0x6000002+0x4d
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context) in Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll:token 0x600008e+0x245
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) in NWebsec.AspNetCore.Middleware.dll:token 0x6000008+0x81
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) in Microsoft.AspNetCore.Diagnostics.dll:token 0x60000bf+0x70
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware: Error: An exception was thrown attempting to execute the error handler.

System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature' from assembly 'Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004989+0x28
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext) in Microsoft.VisualStudio.Web.BrowserLink.dll:token 0x6000004+0x3b
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.Invoke(HttpContext context) in Microsoft.VisualStudio.Web.BrowserLink.dll:token 0x6000002+0x4d
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context) in Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll:token 0x600008e+0x245
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) in NWebsec.AspNetCore.Middleware.dll:token 0x6000008+0x81
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi) in Microsoft.AspNetCore.Diagnostics.dll:token 0x60000bc+0x191
Microsoft.AspNetCore.Server.Kestrel: Error: Connection id "0HM9TNO75NHE7", Request id "0HM9TNO75NHE7:00000001": An unhandled exception was thrown by the application.

System.TypeLoadException: Could not load type 'Microsoft.AspNetCore.Http.Features.IHttpSendFileFeature' from assembly 'Microsoft.AspNetCore.Http.Features, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) in System.Private.CoreLib.dll:token 0x6004989+0x28
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.ExecuteWithFilter(IHttpSocketAdapter injectScriptSocket, String requestId, HttpContext httpContext) in Microsoft.VisualStudio.Web.BrowserLink.dll:token 0x6000004+0x3b
   at Microsoft.VisualStudio.Web.BrowserLink.BrowserLinkMiddleware.Invoke(HttpContext context) in Microsoft.VisualStudio.Web.BrowserLink.dll:token 0x6000002+0x4d
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context) in Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.dll:token 0x600008e+0x245
   at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context) in NWebsec.AspNetCore.Middleware.dll:token 0x6000008+0x81
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) in Microsoft.AspNetCore.Diagnostics.dll:token 0x60000bf+0x70
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi) in Microsoft.AspNetCore.Diagnostics.dll:token 0x60000bc+0x268
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) in Microsoft.AspNetCore.Diagnostics.dll:token 0x60000bf+0xf2
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application) in Microsoft.AspNetCore.Server.Kestrel.Core.dll:token 0x6000a9b+0x1b8
'Oceanside.Website.PosEngineers.App.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0-preview.5.21301.5\System.Net.WebSockets.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Failed to load resource: the server responded with a status of 500 () [chrome-error://chromewebdata/]
crbug/1173575, non-JS module files deprecated.

To Reproduce

As you know, using the BrowserLink library is as simple as calling 'UseBrowserLink()' so I have not gone through the trouble of creating a separate solution for you. I could not figure out who was in charge of the BrowserLink library, I am afraid you will say the Visual Studio team, but here is the version.

<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />

Further technical details

Tratcher commented 3 years ago

Related: https://github.com/aspnet/Announcements/issues/376, https://github.com/aspnet/Announcements/issues/450.

IHttpSendFileFeature has been obsolete since 3.0. Has there been no update to BrowserLink since 2.2? We will have to track down the owner and verify if it's still supported.

pranavkm commented 3 years ago

FYI @jodavis

jodavis commented 3 years ago

We're working on a new solution for Browser Link in .NET 6.0 that won't require that package.

jtbrower commented 3 years ago

@Tratcher it surprised me as well to see how outdated it was. I typically live in the Desktop space so I thought I was overlooking something and that maybe there was an alternative to use with Visual Studio and Web Development. @jodavis thank you and to the others for such a fast response. Will there be previews of this package anytime soon?

jodavis commented 3 years ago

@jtbrower It will be included in an upcoming preview build of VS 2022 (but not ready for Preview 2). Browser Link will work automatically when the project is launched from Visual Studio, so it won't be necessary to include a package in the project anymore.

jtbrower commented 3 years ago

@jodavis Sounds good, thank you.

ghost commented 3 years ago

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.