Freigeben über


Create/Attach a collection on the TFS 2012 failing with the error “Object reference not set to an instance of an object"

There have been a few instances when a TFS process fails with the generic error “Object reference not set to an instance of an object”.

One such instance is when you are trying to attach a collection to the TFS server, the readiness check fails at collection Database configuration phase or the collection creation process fails at the Data tier configuration verification step.

There is either no log generated for the failure or the log ends at the databaseName: entry ,

e.g., [Info @18:08:03.896] databaseName: <DATABASE NAME of COLLECTION>

clip_image001

This does not have much information available as to the cause of failure.

ENVIRONMENT:

TFS 2012.4

SQL 2012

Possible Cause:

One place to start at, is to check your TFS configuration for the Data source connection string. If you had configured TFS using both the SQL instance name as well as the port number then the Data Tier Summary in your TFS Administration console would read “ Data Source=<SQL SERVER NAME>\<INSTANCE NAME>, PORT NUMBER

clip_image002

Resolution:
TFS does not like it when both instance name and port number are used in configuration. You should either specify instance name or a port number, but not both. To fix this, run the RegisterDB command to update name of the data tier server that hosts the configuration database in Visual Studio Team Foundation Server (TFS).

clip_image003

This will update the value of ‘Data Source’ to read just the SQL instance without the port number.

clip_image004

Now the collection creation/attach process should be successful.

clip_image005

If you environment requires SQL to mention both port number and instance name then you can either move to a different SQL instance and/or use SQL Alias.

Note: In TFS 2013 we have added a blocker. From TFS 2013 onwards when you try to configure TFS using both the instance name and the port number you will encounter the below error,

clip_image006

Cheers!

Content created by – Sinduja Karruppiah
Content reviewed by – Romit Gulati