Tuesday, February 2, 2016

What is BrowserLink and how to get rid of that?

We were on a Javascript debugging session which involved Web Workers, FileAPI and jQuery in an http(s) enabled page. There were so many things in the F12 console window which increased the difficulty in debugging the same. When the Web Workers seems not accepting the messages, we started putting so many console.logs to understand where it breaks actually. Soon we notice that there is some .Net exception stack coming in the browser console as follows

[19:45:14 GMT-0400 (Eastern Daylight Time)] Browser Link: Exception thrown when trying to invoke Browser Link extension callback "madskristensen.editorextensions.browserlink.unusedcss.unusedcssextensionfactory.GetIgnoreList":
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at MadsKristensen.EditorExtensions.BrowserLink.UnusedCss.UnusedCssExtension.GetIgnoreList()
   --- 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)

The debugging happened in a dev machine. At first we thought there is some VS extension failing. But why should it come to browser? Sometimes when we debug js inside browser it enters strange file other than jQuery which took to the height of frustration. The debugging was kind of over after some time. But this wired call stack struck in my mind.

Immediately after the debugging, I googled for what is this browser link. I could see that its a feature from Microsoft from VS 2013 on wards, enabled by default for dealing with more browsers. More specifically refreshing multiple browsers associated with Visual Studio. If this is enabled Visual Studio establish links between browsers an can refresh them. It uses modules to inject javascript etc...

Wow...I immediately disabled it by following the below link.

http://blogs.msdn.com/b/webdev/archive/2013/06/28/browser-link-feature-in-visual-studio-preview-2013.aspx

No comments: