title: BrowserLink does not work for ASP.NET Core on Visual Studio 2017 RTM
body: <p>I get the following error in the browser when I enable BrowserLink for my ASP.Net Core 1.1 application and I think because of that the BrowserLink does not work. </p>
  
  <pre><code>Browser Link: Exception thrown when trying to invoke Browser Link extension callback "microsoft.visualstudio.web.browserlink.sourcemappingextensionfactory.getCssMappingData":
  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.EnsureAbsoluteUrl(IVsHierarchy hierarchy, Uri&amp; path)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.GetSimpleVsWebUrlFromUrl(IVsHierarchy hierarchy, Uri url, ILocationContainer&amp; container)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.GetVsWebUrlFromUrl(IVsHierarchy hierarchy, Uri url)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.LazyLocationContainerFromUrl.CreateActualLocationContainer()
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.GetPhysicalPath(Uri&amp; physicalPath)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.DocumentLocation.Microsoft.VisualStudio.Web.Extensions.Common.Helpers.IDocumentLocation.GetPhysicalPath(Uri&amp; physicalPath)
     at Microsoft.VisualStudio.Web.BrowserLink.SourceMappingExtension.getCssMappingData(String cssUrl, String[] selectors)
     --- End of inner exception stack trace ---
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at Microsoft.VisualStudio.Web.BrowserLink.ClientMessaging.DispatchMessage(BrowserLinkConnection connection, MessageArgs obj)
  
  Browser Link: Exception thrown when trying to invoke Browser Link extension callback "microsoft.visualstudio.web.browserlink.autosyncextensionfactory.trackCssDocuments":
  System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.EnsureAbsoluteUrl(IVsHierarchy hierarchy, Uri&amp; path)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.GetSimpleVsWebUrlFromUrl(IVsHierarchy hierarchy, Uri url, ILocationContainer&amp; container)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.VsWebUrlUtil.GetVsWebUrlFromUrl(IVsHierarchy hierarchy, Uri url)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.LazyLocationContainerFromUrl.CreateActualLocationContainer()
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.LazyLocationContainer.GetPhysicalPath(Uri&amp; physicalPath)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.DocumentLocation.Microsoft.VisualStudio.Web.Extensions.Common.Helpers.IDocumentLocation.GetPhysicalPath(Uri&amp; physicalPath)
     at Microsoft.VisualStudio.Web.Extensions.Common.Helpers.DocumentLocation.Microsoft.VisualStudio.Web.Extensions.Common.Helpers.IDocumentLocation.get_PhysicalFileExists()
     at Microsoft.VisualStudio.Web.BrowserLink.AutoSyncExtension.trackCssDocuments(String[] trackHrefs, String[] untrackHrefs)
     --- End of inner exception stack trace ---
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at Microsoft.VisualStudio.Web.BrowserLink.ClientMessaging.DispatchMessage(BrowserLinkConnection connection, MessageArgs obj)
  
  Browser Link: Failed to invoke return value callback:
  TypeError: Cannot read property 'files' of null
  </code></pre>
  
  <p>I have configured my App as follow: </p>
  
  <p>.csproj config: </p>
  
  <pre><code>&lt;ItemGroup&gt;
      &lt;PackageReference Include="AutoMapper" Version="5.2.0" /&gt;
      &lt;PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="1.2.0" /&gt;
      &lt;PackageReference Include="BundlerMinifier.Core" Version="2.4.337" /&gt;
      &lt;PackageReference Include="IdentityModel" Version="2.5.1" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" /&gt;
      &lt;PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" PrivateAssets="All" /&gt;
      &lt;PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" /&gt;
      &lt;PackageReference Include="Serilog.Extensions.Logging.File" Version="1.0.0" /&gt;
  &lt;/ItemGroup&gt;
  
  &lt;ItemGroup&gt;
      &lt;DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /&gt;
      &lt;DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /&gt;
  &lt;/ItemGroup&gt;
  
  &lt;Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"&gt;
      &lt;Exec Command="bower install" /&gt;
      &lt;Exec Command="dotnet bundle" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>And in the Startup.cs file in Configure method I have called <code>app.UseBrowserLink();</code>.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>It seems the error is related to the *.css files. If I remove all my CSS links I only get the following error: </p>
  
  <pre><code>Browser Link: Failed to invoke return value callback:
  TypeError: Cannot read property 'files' of null
  </code></pre>