hexadecimal value 0x07, is an invalid character
Every once in a while I get a message that at first baffles me but once I understand the problem it's hand-smackingly obvious. This error message was one of those.
"hexadecimal value 0x07, is an invalid character"
By now I’ve run into this problem a few times and with a few different converters that target the TFS version control server. Each time the fix has been the same so I thought this time I would share the problem and solution.
The problem in two words is “fancy quotes.”
Each time the issue has been that someone did a copy/paste from Excel or Word into the checkin or label comment box in the source version control system. In doing so they brought over “fancy quotes” from the editor they were copying from.
The reason this is a problem is that the TFS client APIs do not escape the data for the caller (and the server does not un-escape it) so we need to handle it on our own (aside – I think this is a TFS bug and I’m writing it up).
Basically before you send free-text to TFS (comments, usernames, etc) you need to make sure that the text only contains data that conforms to the XML recommendation at the W3C.
https://www.w3.org/TR/2004/REC-xml-20040204/#charsets
Easy enough!
--- (more details for our inner-geek and search engine mojo) ---
The following is the relevant portion of a callstack and the complete error message that I’m talking about:
Microsoft.TeamFoundation.VersionControl.Client.VersionControlException: The value contains characters that are not allowed (control characters, 0xFFFE, or 0xFFFF). Please remove those characters. ---> System.ArgumentException: '
', hexadecimal value 0x07, is an invalid character.
at System.Xml.XmlConvert.VerifyCharData(String data, ExceptionType exceptionType)
at System.Xml.XmlCharCheckingWriter.WriteString(String text)
at System.Xml.XmlWriter.WriteElementString(String localName, String ns, String value)
at System.Xml.XmlWriter.WriteElementString(String localName, String value)
at Microsoft.TeamFoundation.VersionControl.Client.Helper.ToXml(XmlWriter writer, String element, String str)
--- End of inner exception stack trace ---
at Microsoft.TeamFoundation.VersionControl.Client.Helper.ToXml(XmlWriter writer, String element, String str)
at Microsoft.TeamFoundation.VersionControl.Client.Changeset.ToXml(XmlWriter writer, String element)
at Microsoft.TeamFoundation.VersionControl.Client.Repository.CheckIn(String workspaceName, String ownerName, String[] serverItems, Changeset info, CheckinNotificationInfo checkinNotificationInfo, CheckinOptions checkinOptions, Failure[]& failures)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.CheckInInternal(String author, PendingChange[] changes, String comment, CheckinNote checkinNote, WorkItemCheckinInfo[] workItemChanges, PolicyOverrideInfo policyOverride, CheckinOptions checkinOptions)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.CheckIn(PendingChange[] changes, String author, String comment, CheckinNote checkinNote, WorkItemCheckinInfo[] workItemChanges, PolicyOverrideInfo policyOverride, CheckinOptions checkinOptions)
at Microsoft.TeamFoundation.VersionControl.Client.Workspace.CheckIn(PendingChange[] changes, String author, String comment, CheckinNote checkinNote, WorkItemCheckinInfo[] workItemChanges, PolicyOverrideInfo policyOverride)
Comments
- Anonymous
November 14, 2006
Yesterday I made the comment that I thought that the handling of 0x07 was a bug in the TFS client APIs.