Search code examples
c#asp.netvisual-studioasp.net-corebrowser-link

ASP.NET Core Browser Link `Unable to get property 'files'`


In the Microsoft Virtual Academy course 'Introduction to ASP.NET Core (formerly ASP.NET 5)', video 3, at 39:00, they demonstrate how Browser Link can sync code selection between Edge's F12 tools and Visual Studio. I haven't been able to see the same functionality out of the box. I don't know if there's a setting, or something special to enable this. If there is, it wasn't shown in the course video, but then again the video is a couple months old. I've never seen this functionality before.

Browser Link is connected to Visual Studio from Edge, as can be seen in the Browser Link Dashboard in VS. That's all fine.

There is a console log in Edge that seems relevant;

Browser Link: Failed to invoke return value callback:
TypeError: Unable to get property 'files' of undefined or null reference.
browserLink (64,492)

I found the only function in the BrowserLink js that references 'files' and started going up the stack trace. It seems to expect a JSON from localhost:9640/5b39911a4f384282a7625405b2d603cf/browserLinkSignalR with multiple elements, [1] being a list of source files, but is actually null, so catches and posts that console log.

Nothing useful on Google, or their GitHub issues. If there was a relevant Github repo I could be pointed to, I could look it up.

  • Microsoft Visual Studio Enterprise 2015 Version 14.0.25421.03 Update 3
  • Microsoft .NET Core Tools (Preview 2) 14.1.20624.0
  • "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
  • Edge 25.10586.0.0

Solution

  • I fixed this issue by removing the default browserlink package

    Microsoft.VisualStudio.Web.BrowserLink

    and installing

    Microsoft.VisualStudio.Web.BrowserLink.Loader

    Here is an updated guide from Microsoft docs

    I was also getting other errors in the console about missing css with browserlink and this fixed that too.