Editor Error in Visual Studio 2012

Sometimes Visual Studio 2012 goes slightly mad and displays an error message (did not take screenshot, sorry) that it has encountered an exception that might be caused by an extension, and mentions the Activity Log file.

This file is normally located at %appdata%\Microsoft\VisualStudio\11.0\ (where %appdata% is normally C:\Users\<yourUserName>\AppData\Roaming) and is called ActivityLog.xml – one can check the problem in more details (TIP: there is the corresponding xsl file, so the xml file opened in IE will be nicely formatted).

Usually the exception message stored in the ActivityLog.xml will clearly point to the offending extension/plugin.

If it does not, the deleting the %localappdata%\Microsoft\VisualStudio\11.0\ComponentModelCache\Microsoft.VisualStudio.Default.cache file (where %localappdata% is normally C:\Users\<yourUserName>\AppData\Local) might solve the problem. It is safe to delete this file as it will be rebuild when Visual Studio is starting. And, of course, Visual Studio should be closed when you are trying to delete this file.

If even then the problem persists, then pray to god(s) – there is no help for you! :)

TypeScript IntelliSense

We are going to use TypeScript in our product, so imagine my disappointment when I realized that IntelliSense is not working for TypeScript files in Visual Studio 2012, despite it should.

I have tried everything I could – played with VS settings, uninstalled and reinstalled TypeScript, ReSharper, whole Visual Studio… Nothing. Finally, I had to reset my Windows and start from scratch. After two full days completely wasted trying to get IntelliSense working, I finally got to the magic point of having fresh Windows, Visual Studio, and TypeScript. Started it all up, and bang – no IntelliSense again! After pulling some hair out, and crying quietly in the corner, I started second round of uninstalling and installing TypeScript, including older version 0.8.2, Web Essentials, resetting VS settings, etc. Same result. Finally I checked my Visual Studio plugins, and, to my surprise, spotted MySQL Tools for Visual Studio extension, despite I did not want to install it in the first place when MySQL was installed earlier. Removed this plugin, and voila, TypeScript IntelliSense at its best!

What is strange, I have tried to install MySQL server and its Connector/.NET at home (although a newer version package), and surely got the unwelcome MySQL Tools for Visual Studio extension with them. But! The TypeScript IntelliSense works nevertheless, despite a completely different picture was observed at work twice. Go figure.

So, if TypeScript’s IntelliSense is not working, I would recommend to remove all extensions, starting from those more exotic (e.g. MySQL, and those less used by wide population) – it might actually repair the thing.

Visual Studio Behind Proxy: Expectation Failed

We have a transparent proxy at work, and it was causing troubles in Visual Studio 2012 when going to the Extensions and Updates. Contrary to your expectations, “The remote server returned an unexpected response: (417) Expectation failed” message was appearing. The fix is pretty easy, and involves editing devenv.exe.config file in the Visual Studio 2012 folder (normally C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\). Somewhere towards the end of that file there is a

        <ipv6 enabled="true"/>

fragment, which has to be fixed to read

        <ipv6 enabled="true"/>
        <servicePointManager expect100Continue="false"/>

That’s it.

Windows Phone 8 SDK + VirtualBox = Problem

Just installed the Windows Phone 8 SDK and got disappointed when running the sample app on the phone emulator failed with the following cryptic message:

The Windows Phone Emulator wasn’t able to create the virtual machine. Something happened while creating a switch: Xde couldn’t find an IPv4 address for the host machine.

Some people suggested that the problem might be related to the VirtualBox being installed on the machine (I had it). Uninstalling VirtualBox helped, although it is a bit annoying, as I need VirtualBox to access my work VPN.

Toolbox Scrollbar Disappeared in Visual Studio

My colleague just hit into a problem with his Visual Studio 2012 – the Toolbox (the one keeping UI controls) lost its scrollbar. The scrollbar was appearing if he was filtering controls by name, and disappearing again when filtering was off. After searching a bit on the net I found that people were seeing the same problem in Visual Studio 2010 as well. The workaround Barney Nicholls, that post’s author, proposes for Visual Studio 2010 involves deleting toolbox*.* files from the Visual Studio settings’ folder:

  1. Close Visual Studio.
  2. Delete toolbox settings using the commands below.
  3. Start Visual Studio.

The commands (script) to delete the toolbox settings (those files are normally hidden, thus we need to remove the hidden file attribute before):

attrib -h %userprofile%\appdata\local\microsoft\visualstudio\10.0\toolbox*.*
del %userprofile%\appdata\local\microsoft\visualstudio\10.0\toolbox*.*

Needless to say, that this worked for Visual Studio 2012 as well – just substitute 10.0 with 11.0 in the commands above. And, of course, you can perform these operations in Explorer, FAR, or any other file manager as well.

PS Just occurred to me, that there is one more problem, similar in its nature, but with different symptoms – IntelliSense stops working after some actions, e.g. renaming some function. Usually, deleting the hidden .suo file with the same name as the solution .sol file and located in the same folder as the solution file resolves the problem. Of course, Visual Studio must be closed when performing this operation.

Managed/Native Debugging in C#/C++

I had a problem debugging my solution consisting of C#, C++/CLI, and native C++ projects. I was not able to get breakpoints working in the native C++ parts – after running the solution with breakpoints set, they were turning gray with warning sign, and their tooltip stated that “The breakpoint will not currently be hit. No symbols have been loaded for this document.” despite all debug properties were set right on those projects and all debugging symbols existed. After fighting it for a few hours and almost giving up, I started to think that the problem might not be with the native C++ projects, but rather somewhere else, e.g. in the StartUp project, which is C#. Checked that project’s properties, and guess what! Debug > Enable unmanged code debugging option was off!!! Switched it on, and voila – breakpoints work fine in native C++ DLL now!!! :)

Debugging MSBuild Scripts (VS2010)

I did not actively search for the subject, but once I bumped into a three-part article about the MSBuild script debugging (Part I, Part II, Part III) on The Visual Studio Blog I immediately though that it is worth remembering about it when (I am not saying if, but rather when here) I need it in the future. The blog itself is also worth checking, as there is much information about VS IDE, MSBuild, and extensibility from the Visual Studio development team.