Some of the properties associated with the solution could not be read

There are times when loading a solution in Visual Studio 2005 you get a “Some of the properties associated with the solution could not be read” but the solution is nonetheless loaded.

There’s a KB about it, but the problem we had here had nothing to do to what’s being described on the article.

The problem lays on the fact that for some reason, the TFS source control section of the solution file got duplicated and there were multiple instances of it:

GlobalSection(TeamFoundationVersionControl) = preSolution

….

EndGlobalSection

 

To fix the problem:

  1. Unbind the solution from source control
  2. Open the .sln with Notepad and make sure you delete all of the “GlobalSection(TeamFoundationVersionControl) = preSolution” sections from the file.
  3. Bind the solution to source control again.

With that, Visual Studio will recreate the section properly and you should stop receiving the message.

Branching and Merging

This week I’m taking a look into branching and merging strategies in TFS.

VSTS Rangers and MVPs have released guidance for both TFS 2005 and 2008.

Even if you’re using 2005, if you want to dig into a little more details, you should take a look into the 2005 version of the guidance.

Microsoft Team Foundation Server Branching Guidance – Home (for TFS 2005)

TFS Branching Guide 2.0 – Home (for TFS 2008)

And by the way, yesterday I ordered Juan-Luc’s Professional Team Foundation Server from Amazon. It should arrive in two or three weeks.

Running away from Windows Vista

With the launch of Windows 7 beta, a couple of my Messenger buddies have started putting “Running Windows 7” as their quick message. I think I’ll put “Running away from Windows Vista” as mine. 😛

Just kidding. Despite all the bad press about Windows Vista, I’ve been using it on a daily basis for almost a year now on a desktop at home and a laptop at work. In both cases, the machines came with Vista pre installed and work fine.

My desktop at the customers site is still XP as is an old desktop that I have at home. I also have a personal laptop with XP whose hard drive crashed last week. I’m thinking on installing the Windows 7 bits on it to take a spin.

Stay tuned.

Resoluções de 2009

Uma das minhas resoluções de 2009 é praticar mais esportes.

Em 2008 eu já vinha praticando moutain bike e caminhada(mais)/corrida(menos).

Em 2009 espero não passar tanto tempo sem praticar estes dois esportes e quem sabe arrumar alguma outra coisa pra fazer.

No dia 31 eu corri a São Silvestre. Sim eu corri! Corri sem parar os quatro primeiros quilômetros, mas corri.

O resto eu alternei entre caminhada (mais) e corrida (menos), mas completei a prova e senti que tinha energia para ter exigido mais de mim mesmo correndo mais e caminhando menos.

 

http://nikeplus.nike.com/nikeplus/v1/swf/scrapablewidget/rundetail.swf

 

Minha meta atual é conseguir completar 5K correndo direto. Depois disto a meta passa ser baixar os tempos de 5K e começar a tentar completar 10K diretos. Quem sabe no final do ano eu consigo completar a São Silvestre correndo direto?

 

 http://nikeplus.nike.com/nikeplus/v1/swf/scrapablewidget/rundetail.swf

Podcasts on iPod

Recently my 2nd generation iPod Nano got broken and after a little research at Apple’s site I decided to buy an iPod Touch.

I went to a store here in Brazil and bought one only to discover that it was a 1st generation iPod Touch while the one shown on Apple’s site was a 2nd generation one.

The 2nd generation iPod has some features I really wanted so I asked for a friend to bring me one from the US:

  • Built-in sensor for Nike+
  • Hardware buttons for volume
  • Speaker

By the way, it also has a faster ARM processor.

 

 

Before getting the new toy, I used to automatically download audio podcasts via iTunes. I also used to manually download videos from Channel 9 to watch on my desktop. Now I setup iTunes to download automatically all the audio and video podcasts I’m interested in. Here are some of the technical ones:

 

Title

Description

Alt.NET Podcast

Alt.NET Podcast about TDD, BDD, DDD, DI, IoC, and other acronyms

Channel 10

[Channel 10]

Google Developer Podcast

The Google Developer Podcast features interesting news in the developer world from a Google perspective. Listen to interviews with Google Developers and the community as a whole.

Hanselminutes

Hanselminutes is a weekly audio talk show with noted web developer and technologist Scott Hanselman and hosted by Carl Franklin. Scott discusses utilities and tools, gives practical how-to advice, and discusses ASP.NET or Windows issues and workarounds

.NET Rocks!

.NET Rocks! is an Internet Audio Talk Show for Microsoft .NET Developers.

OnMicrosoft (Video)

Conversations & tips from expert IT Pro’s & Developers covering a wide range of programming, systems, & software issues: .NET Framework, WCF, WPF, ASP.NET  AJAX, Silverlight, PowerShell, VSTS, VSTO, LIN, SQL Server, Data-binding, and SharePoint.

OnSoftweare (Audio + Video)

Conversations & tips from the industry’s leading developers across a wide range of programming and development topics: Java, Agile, Software Engineering, Design Patterns, C++, C#, Ruby, Lean, Software Quality, Secure Coding, User-centric Design, and more.

Videos – Channel 9

videos

Descriptions were taken from the feeds themselves. That’s why Channel 9 and 10 aren’t so descriptive.

Fantastic Four

To celebrate the announcement of .NET Framework 4.0, here are four links to stuff I found interesting enough to share with you guys:

  1. .NET 4.0’s game-changing feature? Maybe contracts…
  2. What’s New in the BCL in .NET 4.0
  3. Code Contracts – Make Coding Assumptions Explicit and Tool Discoverable in .NET
  4. Microsoft Solver Foundation – Customer Technology Preview

The main point being that it looks like we’re going to gain Design by Contract (pre-conditions, pos-conditions, etc.) features in the next version of the framework.

Although there are people not very happy about it being a feature of the framework library instead of the language, I’d like to remember that it is totally possible that in the future, the language incorporates syntax sugar that beneath uses the library’s features.

LINQ, “using”, “lock” all use .NET Framework class library methods under the covers, so there’s still hope! If today we have “int?” as a shorthand for Nullable<int>, how cool would it be to have something like “Customer!” for a non-nullable Customer parameter, field or variable!

Most of this design by contract stuff is based on ideas from Spec# – a research language developed by Microsoft Research.

Poster do .NET Framework 4.0

Durante o PDC que rolou lá nos “States” esta semana, a Microsoft liberou a primeira versão preliminar pública do .NET Framework 4.0, Visual Studio 2010 e os planos sobre um monte de outras coisas como o Windows Azure, Windows 7 e por aí vai.

Eu já estou com a minha VM do VSTS 2010 aqui, mas ainda não tive tempo de mexer muito com ele.

A primeira coisa que percebi foi que a Start Page parece ser feita com WPF. Estou bastante curioso para ver o que vem no C# 4.0.

Eles também lançaram um poster sobre as novidades que vieram com a SP1 do Fx 3.5 e o que deve vir no 4.0.

Você encontra uma versão online usando Deep Zoom aqui.

Tem um monte de vídeos a respeito disto tudo lá no Channel 9 .

Bem legal!

TechEd 2008

O TechEd está chegando aí (14 a 16/10) e contará com a presença de ninguém mais ninguém menos que Steve (Developers! Developers! Developers!) Balmer.

Os preparativos já estão a toda. Este ano estarei ministrando duas palestras:

  1. DEV301 – 300- 14/10/2008 14:00 – 15:15 – Sala 2 Melhores Práticas com a Linguagem C# 3.0
  2. WEB301 – 300 – 15/10/2008 09:15 – 10:30 – Sala 7 Internet Explorer 8 Para Desenvolvedores (junto com Miguel Ferreira)

Na palestra “Melhores Práticas com a Linguagem C# 3.0”, eu vou demonstrar os recursos que a linguagem ganhou na versão 3.0 e a melhor forma de usá-los. Também pretendo abordar os principais erros e gotchas que tenho encontrado por aí ao desenvolver o meu código e revisar código dos outros.

Na palestra “Internet Explorer 8 Para Desenvolvedores” eu e o Miguel Ferreira (PM do Windows) vamos mostrar o que o IE8 está trazendo de novidade para os desenvolvedores.

Além disto, estarei respondendo a perguntas no Ask The Experts. Para quem nunca participou de uma sessão destas, é uma chance de ter as suas dúvidas respondidas ali ao vivo e a cores. Imagina como um Fórum MSDN tête-à-tête. Imperdível!

Object creation with generics

Last week I was reviewing some code when I came across something that looked like.

class TypeTranslator<TOrigin, TDestination> {
    public TDestination Convert(TOrigin value) {
        Type typeOfTo = typeof(TDestination);
        TDestination to = (TDestination)typeOfTo.InvokeMember(null, BindingFlags.CreateInstance, null, null, null, CultureInfo.CurrentCulture);

        // goes on and copies the contents of each property from the TFrom object instance to the TTo object instance
        return to;
    }
}

 

The idea is to translate entity types to data transfer types. The class receives the origin and destination types upon instantiation and when Convert is called it creates a new instance of the destination type and populates its properties from the origin type enumerating through all its properties via reflection.

We all know that reflection is slow when compared to accessing the types and members directly, but the real problem on this code lays on the fact that it tries to instantiate a new object using a parameterless constructor, but there is no guarantee that the class has one.

It has all been working based on the convention assumed on the project that these types will all have a public parameterless constructor. What happens if a new developer comes in and unaware of the convention decides to create a constructor with parameters? The compiler seeing that there’s a constructor will not create the default parameterless constructor anymore. Since there’s nothing else checking it, it will only fail at runtime.

A runtime exception would be caught relatively early if they were using unit testing, but they aren’t using it, so it depends on trusting the developer to do the proper tests.

Well, I’m a developer, but I trust more on the compiler doing that job than on myself or whoever for that matter, so I proposed some changes:

class TypeTranslator<TOrigin, TDestination> where TDestination : new() {
    public TDestination Convert2(TOrigin value) {
        TDestination to = new TDestination();
        // goes on and copies the contents of each property from the TFrom object instance to the TTo object instance
        return to;
    }
}

This way, the compiler will guarantee that the type used has a parameterless constructor. Finding issues at compile time is much cheaper than at runtime.