executor

Those of you familiar with Linux systems should know the very helpful “which” command which can tell you where exactly an executable that is in your PATH is located. The good news is, that a very similar command exists in PowerShell

> get-command tf

If the TFS exectuable is in your path, this gives you output of the form.

CommandType     Name                     Definition
-----------     ----                     ----------
Application     TF.exe                   C:\Program Files\Microsoft Visual Studio 9.0\Com...

But that’s not very helpful, is it? I mean, a quite important part of the path is cut off for crying out loud. So how do you get the FULL path?

> get-command tf | format-list

Name            : TF.exe
CommandType     : Application
Definition      : C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe
Extension       : .exe
Path            : C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe
...

And there you go. It’s a bit more complicated than necessary, but at least it’s possible.

For quite some time now, it has happened to me occasionally that attaching the debugger to the w3wp.exe (IIS worker process) to debug a web application gets extremely slow. I’m talking about several minutes to load all the symbols before it could actually start debugging. In the VS status bar you could see that it took about 1 second for each assembly to load – and we’ve got LOTs of them. In the past, the problem usually went away by itself after a reboot or some other Windows “feature”. This week however it just didn’t get any better. After some Googleing I now think that I have found the solution to the problem: simply delete ALL breakpoints and set a couple of new ones. Don’t ask me how or why exactly, but it seems to be quite reliable.

To install Windows 7 on a virtual disk, follow these instructions.

  • Boot from the Windows 7 installation disc
  • Press SHIFT+F10 to open the command prompt
  • Start diskpart.exe
  • If you already haven’t already created a vdisk that you would like to install Win7 on, create one (see previous post)
  • Attach the virtual disk

    > select vdisk file="C:\path\to\vhd"
    > attach vdisk
    > exit

  • Continue with the installation by selecting “Custom Install”
  • Select the virtual disk (if you have formatted and named your disk, you will see that name now, otherwise you will have to consider the disk size)
  • Install Windows 7

The installer will create a boot menu entry for your new Windows installation and your existing non-virtual installation. Unfortunately, they are (by default) both called “Windows 7”. Very helpful… The virtual installation will be the first entry in your boot menu and started by default. Once your installation is complete, you can fix this issue with the “bcdedit.exe” command line tool.

Open a command prompt as administrator and follow these steps:

> bcdedit.exe

This will give you a list of all boot manager entries. Find the one that refers to your VHD file and copy it’s ID – {current} if you are currently running your virtual installation and usually {default} if you’re running the physical installation.

> bcdedit.exe /set description "New boot menu entry"

You can also create copies of your bood menu entries and adjust them to, let’s say, point to a different VHD file.

There is this fancy new feature in Windows 7 called “Boot from VHD”. It essentially allows you to boot your machine from a virtual disk without having to virtualize the rest of your hardware. This can be quite helpful if you want to experiment with your Win7 without reinstalling all the time because you screwed up.

First I’ll explain how you can create and manage virtual disks. In the second part I will discuss how to install a second Win7 on the created virtual disk and how to set up the bootloader correctly.
Continue reading Win7 Boot from VHD – Part I

Today I ran into this problem for the second (and hopefully last) time. Let’s take a look at the words “sorted” and “list”. “sorted” suggests that the items of the list will somehow be sorted. So far, so good. “list” would suggest that you can put any item in the list. Specifically, it isn’t called “SortedSet”, so you could expect that you in fact can add the same item twice with the same key.

Well… that’s where you’d be wrong. The documentation says that the sorted list throws an ArgumentException if “An element with the same key already exists in the SortedList”. Unfortunately I don’t go around looking through the documentation to search for stuff like that. And in fact: you shouldn’t have to. A list is a list and not a set. And if you decide to implement a sorted list with a dictionary as the backing store, then you are – quite frankly – an idiot.

If you would like to save yourself a lot of grief, just don’t use the sorted list. Use a regular List and the Sort method. But be aware, that the Sort method uses the quicksort algorithm which is unstable (elements that are “equal” don’t keep their relative positions to one another).

On Friday I tried to update one of the legacy DataSets of the application I’m working on. When I double-clicked the data set schema, VS just opened the XML view to edit the schema. Quite useless. So I right-clicked the item and selected “View Designer” which then brought up a new window that contained all the inner text of the XML document as one large blob. More than just useless…
Today I started looking for a solution or possible cause for the problem. It would seem that the data set designer was not loaded on VS startup. The solution then was quite simple: Open a command line and start

devenv /resetskippkgs

This tells VS to reset its list of skipped packages and load everything. Now I can use the designer again.