Leon Mayne

I'm trying to add a link in a new work item to a file under source control. I modified some code I found on the net which looks like it should work:

Code Snippet

Dim objLinkType As RegisteredLinkType = objWIStore.RegisteredLinkTypes("Source Code File")

Dim objItem As Item = TfsVersionControl.GetItem(strServerPath, VersionSpec.Latest)

objWi.Links.Add(New ExternalLink(objLinkType, objItem.ArtifactUri.AbsoluteUri))

But when I call objWi.Save() I get the usual TF26201 error. If I remove the above code it saves fine. Any ideas what I'm doing wrong



Re: Team Foundation Server - Work Item Tracking Add link

Luis Fraile

Hmm for me it seems ok, maybe you can try check the fields collection of the workitem and check if everything is valid and if anything is not ok just check the message, just for trying,the code you posted seems ok for me, assuming that "objItem" is ok and you are recieving the correct Uri.






Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

Bizzare. It works fine for some files, and not for others. For example, it's fine with:

$/Alchemy WMS/Prototype 5/src/Databases/Highway/Tables/4.0.5.0 - 010 - Create tblwSentenceTextType.sql

But breaks with

$/Alchemy WMS/Prototype 5/src/Databases/Highway/Data Scripts/4.0.5.0 - 001 - Update Working Minutes for FirstAssessmentbyDirectResourceSLA.sql

I note the AbsoluteUri is quite long:

vstfs:///VersionControl/VersionedItem/Alchemy%252bWMS%25252fProtoType%252b5%25252fsrc%25252fDatabases%25252fHighway%25252fData%252bScripts%25252f4.0.5.0%252b-%252b001%252b-%252bUpdate%252bWorking%252bMinutes%252bfor%252bFirstAssessmentbyDirectResourceSLA.sql%2526changesetVersion%253d6727%2526deletionId%253d0

309 chars for the second vs 253 for the first. Is it overflowing perhaps Is the URI field set to varchar(255) in the TfsWorkItemTracking database





Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

Just tried linking to the same file in a new bug work item in Visual Studio (with a specific changeset version) and I get the same error. I presume this is a TFS bug Should I report it on connect



Re: Team Foundation Server - Work Item Tracking Add link

Luis Fraile

Ufff, pretty strange, I maybe will try (I'm really busy now), but maybe is a good option to report it on connect, just give little bit of time (couple of days) to see if someone can help more, sorry Sad




Re: Team Foundation Server - Work Item Tracking Add link

Amit Ghosh

>> Is the URI field set to varchar(255) in the TfsWorkItemTracking database

Yes, it is, I believe the length is 256. That is why you are getting the error for one where the URI length is 309.

Thanks,
Amit





Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

Doh!

Where is the column in the TFS database





Re: Team Foundation Server - Work Item Tracking Add link

Luis Fraile

Yes, this is the problem (I didn't readed before about the lenght of the Uri), it is the "FilePath" of the "WorkItemFiles" table in TfsWorkItemTracking, this table is used to store the links, an this field is an nvarchar(255), so here you have the problem




Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

OK, do you think it's safe to increase the size of the column (after backing up the database and telling people not to use TFS!) to about 500



Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

I just tried it on a test TFS machine, and go the error message "changing a column data type results in an index that is too large", which means I would have to delete the primary key index if I wanted to make the column larger.

Is there a way to make the column larger and still keep the index I'm not suprised it's too big, considering the primary key is across five columns (including two nvarchar(255) columns)! Can we not change it to a unique constraint instead I'm getting way ahead of myself now! I guess I'll just report this on connect. Speaking of which, which is the best connection to report it to I don't see a place for TFS v1 bugs.





Re: Team Foundation Server - Work Item Tracking Add link

Luis Fraile

Modifying that is not safe at all, as modifying or accessing directly to the database is not supported by Microsoft




Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

OK, do you know the best connection to report this to



Re: Team Foundation Server - Work Item Tracking Add link

Luis Fraile

http://connect.microsoft.com I think is the best on the Team system apart




Re: Team Foundation Server - Work Item Tracking Add link

Leon Mayne

The Team System connection isn't listed. Can I get an invite



Re: Team Foundation Server - Work Item Tracking Add link

Luis Fraile

Try on https://connect.microsoft.com/VisualStudio it is used also for TFS issues