Unable to attach remote debugger after Visual Studio 2015 Update 2

As the title states: I was unable to attach the remote debugger (for instance to an Azure Web App) after installing Visual Studio 2015 Update 2. I got an error with something about invalid memory access or something like that.

The solution is simple: install Remote Tools for Visual Studio 2015 Update 2. Go to the webite, pick your machine’s architecture (the x86 install won’t run on a x64 machine) and click download. After installing, you’re good to go!

Hope this helps.

PS: There’s a list of Related releases on the Visual Studio 2015 Update 2 page. Have a look, it’s helpful ;)

Visual Studio 2012 crashes when opening an ASP.NET MVC project with a cshtml open

vscrash A rather long title for this post, but that’s exactly what happened: when I opened an ASP.NET MVC 4 project with a cshtml view open, Visual Studio would crash with the error messages seen on the right. This would only occur if the first project I opened had a cshtml file open. When I opened another (type of) project first and then opened a project with a cshtml file open, the problem did not occur. Debugging Visual Studio with a new instance of Visual Studio (Inception anyone?) made things a bit clearer. (Part of) the exception information:

Source
WebEssentials2012

Message
Could not load type ‘Microsoft.Less.Core.LessMixinDeclaration’ from assembly ‘Microsoft.VisualStudio.Web.Extensions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

After searching around a bit, I found this blog post by Mads Kristensen: Web Tools 2012.2 and Web Essentials. This post talks about Web Tools 2012.2 and Web Essentials 2.5, and how an error can occur if you install Web Tools 2012.2 and don’t upgrade to Web Essentials 2.5. However, I do have Web Essentials 2.5.1 installed so this issue shouldn’t be the same as mine.

Although my situation didn’t match the one on Mads’s blog, I decided to install Web Tools 2012.2 just to see what the result would be. As it turned out, installing the Web Tools 2012.2 did solve the problem. Here’s why I think this solved it:

I had an older version of WebEssentials installed, which included specific functionality. This functionality was moved to Web Tools, and out of the new version of Web Essentials. When I updated to the new version of Web Essentials (without having Web Tools installed!), the functionality was no longer available in Web Essentials giving me the ‘Could not load type’ exception.
I’m not sure why the exception did not occur when I opened a different project first or if this is the exact reason of the exception occurring. I’ll contact Mads to share my findings, he might be able to reproduce this.

Hope this helps

Debugging JavaScript with Visual Studio in an ASP.NET MVC 4 application

When debugging JavaScript in an ASP.NET MVC (4) application, it is not always enough to uncheck the ‘Disable script debugging’ checkboxes under ‘Tools’ – ‘Internet Options’ – ‘Advanced’ – ‘Browsing’. JavaScript inside a Razor view (a cshtml file) cannot be debugged from Visual Studio. To debug your JavaScript, move it to a separate .js file and link to that file from your Razor view. This way, breakpoints set in the JavaScript will be hit and you can debug from Visual Studio.

Hope this helps

 

Disclaimer: I know about the F12 Developer Tools, Firebug and all the other possibilities we have to debug JavaScript. This post is about getting JavaScript debugging to work with Visual Studio and breakpoints set in Visual Studio. For those who want it that way. So there… ;)