This project is read-only.

CodeMetrics randomly throws exception "Whitespace must appear between attributes"

Aug 1, 2013 at 7:03 PM
I'm using the July 2013 version on TFS 2012 and with no apparent pattern the activity is throwing an exception.

I read the docs on this site to set up my Environment, the only difference is that I don't have VS2010 on my TFS server (just VS2012) so i used the version 11 of metrics.exe (in fact I copied the whole FxCop directory from "Microsoft Visual Studio 11.0" to "Microsoft Visual Studio 10.0" because it appears the path is hard-coded somewhere.

I added the CodeMetrics activity to the default template, and is working but randomly I'm getting the same exception, if a queued another build with the Verbosity set to Diagnostic the exception does not happen again

I attach the stack trace and if you need more info let me know.

Thanks
Error: Whitespace must appear between attributes. Line 1, position 1442.. Stack Trace:    at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, XmlException exception)
   at System.Xml.XmlUTF8TextReader.ReadAttributes()
   at System.Xml.XmlUTF8TextReader.ReadStartElement()
   at System.Xml.XmlUTF8TextReader.Read()
   at Microsoft.TeamFoundation.Build.Client.InformationField.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Common.XmlHelper.ArrayOfObjectFromXmlT
   at Microsoft.TeamFoundation.Build.Client.Helper.ArrayOfInformationFieldFromXml(IServiceProvider serviceProvider, XmlReader reader, Boolean inline)
   at Microsoft.TeamFoundation.Build.Client.BuildInformationNode.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Common.XmlHelper.ArrayOfObjectFromXmlT
   at Microsoft.TeamFoundation.Build.Client.Helper.ArrayOfBuildInformationNodeFromXml(IServiceProvider serviceProvider, XmlReader reader, Boolean inline)
   at Microsoft.TeamFoundation.Build.Client.BuildDetail.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Common.XmlHelper.ArrayOfObjectFromXmlT
   at Microsoft.TeamFoundation.Build.Client.BuildQueryResult.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Build.Client.BuildWebService4.QueryBuildsByUriClientOperation.ReadResult(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation operation, TfsMessage message, Object[]& outputs)
   at Microsoft.TeamFoundation.Build.Client.BuildWebService4.QueryBuildsByUri(Uri[] uris, String[] informationTypes, QueryOptions options, QueryDeletedOption deletedOption)
   at Microsoft.TeamFoundation.Build.Client.BuildServer.GetBuild(Uri buildUri, String[] informationTypes, QueryOptions queryOptions, QueryDeletedOption queryDeletedOption)
   at Microsoft.TeamFoundation.Build.Client.BuildDetail.Refresh(String[] informationTypes, QueryOptions queryOptions)
   at Microsoft.TeamFoundation.Build.Workflow.Tracking.BuildTrackingParticipant.GetActivityTracking(ActivityContext context)
   at TfsBuildExtensions.Activities.CodeQuality.CodeMetrics.InternalExecute()
   at TfsBuildExtensions.Activities.BaseCodeActivity.Execute(CodeActivityContext context). 
 Exception Message: Whitespace must appear between attributes. Line 1, position 1442. (type XmlException)
Exception Stack Trace:    at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, XmlException exception)
   at System.Xml.XmlUTF8TextReader.ReadAttributes()
   at System.Xml.XmlUTF8TextReader.ReadStartElement()
   at System.Xml.XmlUTF8TextReader.Read()
   at Microsoft.TeamFoundation.Build.Client.InformationField.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Common.XmlHelper.ArrayOfObjectFromXmlT
   at Microsoft.TeamFoundation.Build.Client.Helper.ArrayOfInformationFieldFromXml(IServiceProvider serviceProvider, XmlReader reader, Boolean inline)
   at Microsoft.TeamFoundation.Build.Client.BuildInformationNode.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Common.XmlHelper.ArrayOfObjectFromXmlT
   at Microsoft.TeamFoundation.Build.Client.Helper.ArrayOfBuildInformationNodeFromXml(IServiceProvider serviceProvider, XmlReader reader, Boolean inline)
   at Microsoft.TeamFoundation.Build.Client.BuildDetail.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Common.XmlHelper.ArrayOfObjectFromXmlT
   at Microsoft.TeamFoundation.Build.Client.BuildQueryResult.FromXml(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Build.Client.BuildWebService4.QueryBuildsByUriClientOperation.ReadResult(IServiceProvider serviceProvider, XmlReader reader)
   at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation operation, TfsMessage message, Object[]& outputs)
   at Microsoft.TeamFoundation.Build.Client.BuildWebService4.QueryBuildsByUri(Uri[] uris, String[] informationTypes, QueryOptions options, QueryDeletedOption deletedOption)
   at Microsoft.TeamFoundation.Build.Client.BuildServer.GetBuild(Uri buildUri, String[] informationTypes, QueryOptions queryOptions, QueryDeletedOption queryDeletedOption)
   at Microsoft.TeamFoundation.Build.Client.BuildDetail.Refresh(String[] informationTypes, QueryOptions queryOptions)
   at Microsoft.TeamFoundation.Build.Workflow.Tracking.BuildTrackingParticipant.GetActivityTracking(ActivityContext context)
   at TfsBuildExtensions.Activities.CodeQuality.CodeMetrics.InternalExecute()
   at TfsBuildExtensions.Activities.BaseCodeActivity.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Oct 16, 2013 at 8:02 PM
Do you get the same results with the Sep release? Did you resolve this in another way or is it still an issue?
Oct 17, 2013 at 7:33 AM
I'm still getting the error randomly, will try the Sep release and report back.
Nov 15, 2013 at 10:49 PM
I upgraded to the Sep release and so far I haven't see the error.
Marked as answer by mikeFourie on 11/29/2013 at 9:40 AM