GetLatestChangeset-Activity fails on TFS

Nov 5, 2015 at 8:43 AM
Hi folks,

i would like to use the GetLatestChangeset-Activity to find out the latest changeset of a given branch. (BuildDetail.SourceGetVersion gives me the latest changeset id of the whole Team Project Collection which is useless for me).
When i drop the activity into the build process template without editing any property the build will fail with the message:
 Error: Object reference not set to an instance of an object.. Stack Trace:    at TfsBuildExtensions.Activities.TeamFoundationServer.GetLatestChangeset.InternalExecute() in c:\code\teambuild2010contrib\CustomActivities\Legacy\VS2012\Source\Activities\TeamFoundationServer\GetLatestChangeset.cs:line 45
   at TfsBuildExtensions.Activities.BaseCodeActivity.Execute(CodeActivityContext context) in c:\code\teambuild2010contrib\CustomActivities\Legacy\VS2012\Source\Common\BaseCodeActivity.cs:line 66. 
 Exception Message: Object reference not set to an instance of an object. (type NullReferenceException)
Exception Stack Trace:    at TfsBuildExtensions.Activities.TeamFoundationServer.GetLatestChangeset.InternalExecute() in c:\code\teambuild2010contrib\CustomActivities\Legacy\VS2012\Source\Activities\TeamFoundationServer\GetLatestChangeset.cs:line 45
   at TfsBuildExtensions.Activities.BaseCodeActivity.Execute(CodeActivityContext context) in c:\code\teambuild2010contrib\CustomActivities\Legacy\VS2012\Source\Common\BaseCodeActivity.cs:line 90
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
BUT when i use it in an assign operation, like "changeset = New TfsBuildExtensions.Activities.TeamFoundationServer.GetLatestChangeset().ToString" it will pass and i get the changeset id (of the team project collection).

I don't get it.
Can anyone please help?
Thanks!