I have recently upgraded my SSD disk to a newer and larger one. To avoid the hassle of re-installing everything (I have a lot of things to install) I cloned the disk. Everything worked fine. No problems with the operating system and the applications, except for Visual Studio. Though I could start, edit, build, run, etc. some things just did not work.

When I opened a solution with both C++ and .NET projects I noticed that the C++ projects took a lot to initialize. When I say a lot I mean minutes, many minutes. That didn’t seem right, but I had patience. However, after they finally passed the Initializing phase I noticed that it was no possible to select the configuration and target for the solution to build. The combos were disabled and nothing was displayed there. I could actually build, but it was the last selected configuration and target that were built. I tried deleting generated files (such as the .suo file) and after that, the last selections appeared in those combos, but they where still disabled.

vstrb3

Then I noticed that the properties window was not able to show anything, whether it was the properties of the project, a file or a reference. Everything was very slow. I could edit, but sometimes it took seconds for the text to show up. When I checked the resource monitor, it turned out that Visual Studio was using 17-18% of my CPU.

vstrb1

Finally, I noticed a warning when I closed the solution:

vstrb2

The .sdf file was not present in the specified location. So then I figured it must be a problem with Microsoft SQL Server Compact. Therefore I downloaded the kit from the download center and installed it again. That worked like a charm. Visual Studio was able to create the missing .sdf file, the Visual C++ projects loaded very fast and all other symptoms disappeared.

My conclusion was that cloning the hard-disk didn’t work well for SQL Server Compact. But the problem is that Visual Studio doesn’t react well when this component is missing. It should display the warning about it when it fails to create the file, not when you close the solution.

, , , , , Hits for this post: 19877 .

Visual Studio 2012 introduced a new framework for writing debugger visualizers for C++ types that replaced the old autoexp.dat file. The new framework offers xml syntax, better diagnostics, versioning and multiple file support.

Visualizers are defined in XML files with extension .natvis. These visualizers are loaded each time the debugger starts. That means if you make a change to visualizers, it is not necessary to re-start Visual Studio, just re-start the debugger (for instance detach and re-attach the debugger to the process you debug).

These files can be located under one of these locations:

  • %VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers (requires admin access)
  • %USERPROFILE%\My Documents\Visual Studio 2012\Visualizers\
  • VS extension folders

In Visual Studio “14” CTP (in response to a UserVoice request) these files can also be added to a Visual C++ project for easier management and source control integration. All you have to do is add the .natvis file to your .vcxproj file.

Here is an example. Suppose we have the following code:

If you run this in debugger you can inspect the value of p and it looks like this:
natvis1

To change the way the point objects are visualized create a file called point.natvis with the following content:

Add this file to the project.
natvis3
When you run the application in debugger again the point object is visualized according to the per-project .natvis file.
natvis2

UPDATE
There are two things to note:

  • changes in the natvis files are now picked up automatically by the debugger; you no longer need to stop the debugging session and then start again if you make changes to a natvis file
  • natvis files from the project are evaluated after all the other files from the other possible locations; that means you can override existing (general) visualizers with project-specific visualizers

For more see Project Support for Natvis.

, , , , , Hits for this post: 29907 .

Visual Studio 2013 provides developers with the ability to sign in with a Microsoft account and synchronize settings across devices (and as new versions will be released across different versions of Visual Studio).

When you first launch Visual Studio 2013 you are asked to sign in (you can skip that and do it any time later) using a Microsoft account.
vs2013signin1

You have to specify several details such as full name, email address and preferred development environment settings.
vs2013signin3

On the top-right corner of the IDE main window you can open the identity card for your primary online identity.
vs2013signin4

If you are not logged in a link for the sign in window is available in that corner.
vs2013signin5

After your initial profile settings is created whenever you logon to new devices your settings will be automatically downloaded and enabled for you. When you logout from a device Visual Studio stops roaming settings to or from that devices but leases the last settings that were synced as they were when you logged out.

You can control what features you want to synchronize from Tools > Options > Environment > Synchronized Settings.
vs2013sync
The features available in the Preview for synchronization are:

  • Appearance (theme, fonts and color) settings
  • Text editor settings
  • Key bindings
  • Start-up settings
  • Environment aliases

You can read more about these features here:

, , , , , Hits for this post: 43070 .

Trying to figure out in which process a particular DLL is currently loaded, I have found two solutions (perhaps there are more).

Solution 1: tasklist.exe

Solution 2: listdlls.exe (from sysinternals)

It might be that listdlls is more reliable than tasklist. I have ran into cases when tasklist failed to list processes that had a specific dll loaded, while listdlls was showing them.

, , Hits for this post: 25952 .

Windows 8 RTM is not ready yet, but lots of things have been updated already with regard to the new version of the OS. Among them the download page for Debugging Tools for Windows.

Here a screenshot from the page.

Notice the following paragraph:

There are certain rare circumstances in which you might need to download the Windows 7 version of Debugging Tools for Windows.

So working on Windows 7 and wishing to install the Windows 7 SDK is nowadays a “certain rare circumstance”. You wish, Microsoft!

, , , , Hits for this post: 31012 .

Let’s say you have this VC++ project (or maybe more) targeting a 64-bit platform (x64 or IA64). You have the sources, everything is set. You build the solution and your project is skipped. You try again, maybe do a rebuild. The project is still skipped. You check the solution’s configuration manager, and the project is indeed checked for building. What could be wrong?

You open the project properties but the page doesn’t load. You get this error:

What’s happening?

What’s happening is that you are missing the x64/IA64 compiler and tools. You did not check them when you installed Visual Studio.



You have to go back to the setup and add this component. However, you must notice that if you have installed the service pack for Visual Studio (regardless the version and edition) you must remove the service pack first, run the original setup, add the x64/IA64 compiler and tools and then install the service pack back. Otherwise the original setup for Visual Studio will fail. The reason is the service pack installation overrides things, making the original setup unable to run again.

, , , , , Hits for this post: 47371 .

Productivity Power Tools is a Visual Studio 2010 add-in, developed by the Microsoft Visual Studio Platform Team and available in Visual Studio Gallery. Of course, you can also download it using Visual Studio Extension Manager, from the Tools menu in Visual Studio 2010.

Its list of features is detailed on the add-in page and I will not enumerate them here. I just want to list the features that I find most useful (at least so far). All these features are enabled by default, but the add-in is very customizable. To enable/disable features or change current settings use the Options dialog and go the Productivity Power Tools page.

Highlight Current Line
The line where your cursor is displayed is highlighted so that you can easily spot it. Here is a screen shot.

Go to Definition
If you press the Ctrl key while the cursor is over a symbol, the symbol appears as a hyperlink and clicking it will take you to the definition.

Move Lines
You can move the current line or an entire selection up with Atl + Up Arrow, or down with Atl + Down Arrow. Useful to avoid Ctrl + X and Ctrl + V, unless you have to move too many lines up or down.

Modified Document Mark
Modified, but yet not saved documents, are indicated with a red dot on the tab.

Pinned Tabs
You can pin tabs on the tab bar. When you hover the cursor over a tab, a pin indicator appears. You can click it and then the tab is pinned on the tab bar, from left to right, so that no mater how many documents you open, the pinned tabs remain visible and you are able to quickly access them.

Undo Close
Recently closed documents are listed in a new tool window called Undo Close. You can double click them and they will be re-opened (and removed from the undo close list).

Floating Tabs
Many developers use two monitors (or even more). Now it is possible to dock floating tabs on a second monitor just as you’d do with a tool window. The following screen shot shows two tabs docked into a separate window on a second monitor.

Solution Navigator
A brand new solution explorer has been created allowing you to easily navigate the solution. You can search it, filter it to see only opened, unsaved, edited or all files, view related information about classes and members, preview images, etc.

The following image shows: the entire solution (left), only the items that contain the word thumb (middle) and only the opened items shown within their projects (right).

Another cool feature is the image preview. All you have to do is hover the cursor over an image and you get a preview of it, as shown below.

Looking forward to seeing these features by default in Visual Studio and not available through an add-in.

, , Hits for this post: 35007 .

Microsoft has made available a first beta version of an experimental version of .NET 4.0, called .NET Framework 4.0 Beta 1 Enabled for Software Transactional Memory v1.0. Since that is quite a long name, the short one is STM.NET. This is a special version of .NET 4.0 that enables software transactional memory for C#. It allows programmers to demarcate regions of code as operating in an atomic, isolated transaction from other code running concurrently. The means to do this is a delegate called Atomic.Do, or try-catch blocks. Might be that in the future an ‘atomic’ block will be added to the language(s).

This first version of the framework, also comes with additional tools:

  • tooling (debugging, ETW tracing)
  • lock interoperability
  • interoperability with traditional transactions
  • annotations (how methods run in transactions, suppressed transactions on methods, etc.)
  • static and dynamic checking of annotations

On the other hand there are some limitations:

  • only works for C# for now
  • cannot be installed on a machine with VS 2010, nor the opposite
  • there is only a 32-bit version

More information about it can be found at the STM team blog or MSDN DevLabs.

, , , Hits for this post: 45748 .

Here is a list of new things in Visual Studio 2010 for unmanaged development.

Visual Studio IDE:

Visual C++

Visual Studio Tools:

Additional readings:

, , , , Hits for this post: 52259 .