Saturday, July 21, 2007

Limitations using XPath and BisSubscribe

First of all sorry for being quite for the last few months but after all it's summer and vaction times. I've been enjoying such activities as island hopping in Greece with the family, renovating the house (which mostely sucks) and the occasional spare hour of programming on my pet project TfsBuildLab (which I hope will get it's first public release this weekend).

Anyway, from now on I'll try to be more regular in my postings, I'll start with finnishing of a few that has been laying around in draft mode for awhile now :)

First out as the title states is a smaller limitation I bumped into when trying to setup email notfications using the built in functionality in TFS (namely BisSubscribe.exe which you can read more about in my previous posts here and here).

Imagine that you need to setup a notification whenever a checkin occurs on a particular file extension and prefer to use xpath over regexp. The following two xpath expressions as both legal xpath examples for this but only the first will work:

Artifacts/Artifact[contains(@ServerItem, ".cls")] <> null

count(Artifacts/Artifact[contains(@ServerItem, ".cls")]) > 1

The reason for this is the fact (which is illustrated by viewing the error message recieved when the notification filter is applied at runtime) TFS will append the filter you pass in to BusSubscribe with /CheckinEvent/ effectivly already positioning us in the document and we need to compensate for this.

TF53010: An unexpected condition has occurred in a Team
Foundation component. The information contained here should be made available to
your site administrative staff.
Technical Information (for the
administrative staff):
Date (UTC): 2007-04-05 10:25:08
Machine:
[SERVERNAME]
Application Domain:
/LM/W3SVC/3/Root/services-2-128202238136148894
Assembly:
Microsoft.TeamFoundation.Server, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process
Name: w3wp
Process Id: 6176
Thread Id: 784
Account name:
[DOMAIN]\[ACCOUNT]

Detailed Message: TF50285: Exception matching
subscription: Microsoft.TeamFoundation.Server.SubscriptionOnServer:
System.Xml.XPath.XPathException:
'/CheckinEvent/count(Artifacts/Artifact[contains(@Folder, ".idl")])' has an
invalid token.

No comments:

Post a Comment