Browsing Posts published in August, 2006

Here’s an interesting bit of CLR trivia for you. The CLR behaves differently with respect to how aggressively it considers references dead depending on whether or not a debugger is attached. Take the following code as an example:

public void Foo() {

    Bar b = new Bar();

    // Do some stuff with b

    for(int i = 0; i < int.MaxValue; i++) {



    // What does b point to here?

    // What if we add GC.KeepAlive(b);


Note that the local variable, b, is not referenced in the loop or afterwards. If we are debugging the application and examine the local variable, b, after the loop, b still points to the new Bar instance created at the top of the method because b is still accessible in the current scope. If a debugger is not attached, the GC notes that b isn’t used in the loop or afterward and collects it aggressively. The reason for the difference in behaviour is for ease of debugging.

Another interesting note is the effect of GC.KeepAlive. By adding a call to GC.KeepAlive to the end of the Foo method, we are extending the lifetime of b, regardless of whether a debugger is attached or not, because we are passing the b reference to a method. The method body of GC.KeepAlive doesn’t contain any code. Its sole purpose is to keep the reference alive so that it is not collected by the GC.

Thanks to everyone who attended my talk on Introducing Windows CardSpace. It was one of the liveliest talks I’ve given. I had lots of great questions throughout the presentation and some great discussions with people during and after. I’ve posted the slidedeck here (5086 KB). Following is a list of resources (reproduced from the slidedeck) for those of you who want to learn more about Windows CardSpace.

Windows CardSpace


Identity Blogs

Overall I’ve had good first impressions of Team Foundation Server, which I installed and configured for a client. We installed TFS Workgroup Edition to get started and later wanted to upgrade to the full version, which the client acquired through volume licensing. Upgrading from Workgroup (or Trial) Edition to the full version using a volume license key (VLK) is far from well-documented. Here’s the steps:

  1. Find your license key by browsing your TFS (VLK) install media for the file DVD-ROM:\\atdt\setup.sdb and open it in Notepad. Go to the bottom of the file (or search for [Product Key].
  2. On the TFS box*, start Add/Remove Programs.
  3. Change/Remove Microsoft Visual Studio 2005 Team Foundation Server.
  4. Select update product key and enter the product key you found in step 1. You’ll have to type it in manually or copy/paste in groups of 5 characters.
  5. Click OK and TFS should restart. You are now running the full version of TFS.

You can optionally remove users from the [SERVER]\Team Foundation Licensed Users group as this group is only used in Workgroup mode. I recommend removing everyone from this group as it will reduce future confusion if you ever have to troubleshoot authorization issues with TFS.

* Repeat these steps on both application and data tier boxes if you have a multi-server installation.

I’ll be talking about Microsoft’s new identity metasystem, Windows CardSpace, at the Calgary .NET User Group on August 15, 2006 starting at 5pm. The event will be held at Calgary Place, Tower 1 - 11th Floor (3rd Street SW, between 4th Ave SW and 5th Ave SW). Registration is available through the Calgary .NET User Group website. The event is kindly being sponsored by IRM Systems. Here’s the session abstract:

Windows CardSpace (formerly “InfoCard”) is a Microsoft .NET Framework version 3.0 (formerly WinFX) component that provides the consistent user experience required by the identity metasystem. It is specifically hardened against tampering and spoofing to protect the end user’s digital identities and maintain end-user control. Password fatigue and online fraud is a growing problem and is shaking users’ confidence in the safety and security of the Internet. Windows CardSpace is a new technology from Microsoft that helps address the problem of managing and disclosing identity information.

Windows CardSpace implements the core of the Identity Metasystem, using open standard protocols to securely negotiate, request and broker identity information between trusted identity providers and requesters. In this session, learn about the rationale behind the Identity Metasystem, Windows CardSpace and how technologies including the Windows Communication Foundation can help you easily integrate a secure, consistent identity infrastructure into your own applications, Web sites and Web services.

UPDATE: Jean-Paul Boodhoo will be presenting the second part of Evolving to Patterns. So you get to hear about two great topics at one event. Come one, come all! Jean-Paul is a very passionate and knowledgeable speaker about many topics, but especially around patterns and test-driven development (TDD).

UPDATE UPDATED: Jean-Paul Boodhoo has unfortunately been called out of town on a family matter and will not be able to present Tuesday night. Calgary .NET is planning to have him present the second part of Evolving to Patterns at a future event. Instead I’ll be covering more of CardSpace.