metro-visual-studio-2005-128-link

imageI have recently been working on a TFS Integration Platform Adapter for integrating with Test Track Pro. The problem with TTP is that it does not contain any history.


  • Update 2011-06-03 – Found the problem with the “index” and I can now migrate new work items again.


Although I have had my Test Track Pro Tip Adapter working for quite some time, the customer came back and asked if they could have a rolling migration. i.e. Shipping changes on a regular basis, but only the TIP each time.


The problem I ran into was that as all of the example Adapters are TIP adapters they do not take into account history at all. Here is the code for my first run through that was heavily based on Robert MacLean’s code from How to create an adapter for the TFS Integration Platform:

Figure: Full source for the Analysis Provider v1

 

Figure: Snipit of the Analysis Provider v1

The problem that I have encountered is that although it adds new Work Items that come into scope, it does not do any updates to those work item. Now, I can understand this if there had been any updates on the TFS side, but I can guarantee that there has not. So I sought help:

  • Action == Edit when pushing changes and == Add for a new one is correct.
  • Version … without debugging the consensus is that the lack of version information is causing the TIP type migration, rather than auctioning the history (edits).
  • Version Merge property … for VC only.
  • Ideas for Version property:
    • Option 1 – Create fake version numbers for the TTP side and using a single incrementing integer watermark across all of the TTP items.
    • Option 1 – Create fake version numbers for the TTP side and just copy the ChangeAction’s ChangeActionId value for this.

-Willy-Peter Schaub, VSALM Ranger Mother

So I changed my code so that when the create action occurred it passed in a version (work item revision) number. As my source system does not have revisions, and does not even keep track of edits I just have to make up the number as long as it is greater than the one before. I went for Option 1 provided by Willy.


Figure: Full source code for new Analysis Provider v2

Figure: Snipit of the Analysis Provider v2

You can see in the full source for v2 of the Analysis Provider that I have added a new high watermark for the revision that should stay in sync with the number of runs of the migration there have been. This way, all of the edit’s  that happen on the third run will have a revision number of 3.

image

Figure: None of the originally imported data has a revision.

The problem now is that no matter how many times I run the import in my test environment I can’t get it to perform an edit. I am hoping that someone will be able to spot a silly mistake on my code that will solve this problem. it is one of those “stare at it for hours hoping it will just work” problems.

And it gets worse, now when I try to run the code I get an “Index was out of range” exception for the TFS server that I just can’t track down. I have even backed all my code back to a known working version and I still get the error. I have even gone so far as to restart the Target TFS server and try another one. Here is the log I keep getting:

Figure: Index was out of range. Must be non-negative and less than the size of the collection

My last and only hope is that in all the development and debugging the I broke the TFS Integration Platform install, so I am going to:

  1. Uninstall TFS Integration Platform
  2. Clean “C:Program Files (x86)Microsoft Team Foundation Server Integration Tools” of all files
  3. Check all locations where files are stored after the craziness that is getting the source for the TFS Integration Platform to build

 

SNAGHTML219c74f

Figure: Reinstalling the TFS Integration Platform is thankfully quick

So, that did not help and I am now getting two error messages for the data that I am parsing. Both of which are coming from TFS and are realy confusing me. The first is a “Index was out of range” error, which is just beyond me as I am not even passing any arrays.

Figure: Index was out of range. Must be non-negative and less than the size of the collection

The second is a date format exception that I would have thought should be taken care of by the Integration Platform and not wait until it gets to TFS.

Figure: String was not recognized as a valid DateTime

I have even checked the output that is sent to the TFS web service and I can’t see anything that jumps out as a problem…