I have been writing a tool in c# that will produce a html report on the changesets and work items associated with builds in between certain dates. The report also includes links for the Changesets and Work Items using a method described in this question. When I run the tool, I don't get any problems, but I have given it to some others to test and there are some mixed results. Some are able to run the tool with no problems, but others are getting errors when they run it on machines that do not have TFS 2010 installed. The error message in question is
System.NullReferenceException: Object reference not set to an instance of an object at Microsoft.TeamFoundation.VersionControl.Client.Changeset.get_WorkItems()
From testing on such machines, I have found that my tool connects to TFS without issue and can also read the Chageset items without issue, but when it comes to get details for the Work Items associated with the changesets, the error occurs. The code to get the Work Items to loop around is
WorkItem[] csWorkItems = changeSet.WorkItems;
I'm rather confused as to why this causes an error on machines that do not have TFS 2010 installed. Also, I have had a look at the report on these machines, and the links to the changesets and work items work correctly!
Can anyone give me a reason why this doesn't work and how to fix it, or maybe give me an alternative to the way i get can the Work Item objects without causing this error?