question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

  • ASP.NET Core version 6.0.0-preview.5
    • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version : Tried it on Visual Studio 2022 17.0.0 Preview 1.1 and 2019 16.11.0 Preview 2.0
  • Include the output of dotnet --info
.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0-preview.5.21301.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0-preview.5.21301.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0-preview.5.21301.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Summary

Again sorry for the quick post, but I am hoping that if nothing else, the next person who runs into this issue will come across this information with a search engine. As stated, I can use Net5 to develop the views and then switch to Net6, but it would be great if there was a working alternative for BrowserLink before the API was removed. Thanks for all the hard work you all do. Its been amazing to chase all of the improvements in the frameworks over the last 5 years.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jodaviscommented, Jul 3, 2021

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

0reactions
msftbot[bot]commented, Jul 7, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browserlink causes "TypeLoadException" for 'Microsoft. ...
Describe the bug After updating from RC1 to RC2 i get the following error. As the stacktrace implies its from the browserlink.
Read more >
How to disable Browser Link in ASP.NET Core (.NET 6, VS ...
I want to stop this behaviour, and I ran out of options how. Is this something that the IIS Express or Visual Studio...
Read more >
Migrate from ASP.NET Core 5.0 to 6.0
Learn how to migrate an ASP.NET Core 5.0 project to ASP.NET Core 6.0.
Read more >
Browser Link doesn't work with ASP.NET Core
I have the same problem! I have added the Microsoft.VisualStudio.Web.BrowserLink package and used the app.UseBrowserLink() in the Startup.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found