This project is read-only.

CodeMetrics activity crashing when run on CI build

Aug 28, 2012 at 7:51 PM

I see this when I try to add the CodeMetrics activity to a CI build where DropLocation isn't set.  How can I use it in this situation?

Error: Value cannot be null. Parameter name: path1. Stack Trace:
    at System.IO.Path.Combine(String path1, String path2)
    at TfsBuildExtensions.Activities.CodeQuality.CodeMetrics.InternalExecute()
    at TfsBuildExtensions.Activities.BaseCodeActivity.Execute(CodeActivityContext context).

(it seems pretty quiet here in this discussion area, is there a better way to ask these types of questions?)

Aug 29, 2012 at 11:58 AM

no this is the right place! ... I'll try take a look and see if there is a workaround... Mike

Sep 4, 2012 at 5:16 PM


Have you figured out any way to get the CodeMetrics activity to work on a CI build where DropLocation is not set?

As I see it, there may need to be a code change done to somehow let the metrics file get generated on the build server if DropLocation is empty.

        protected override void InternalExecute()
            this.logCodeMetrics = this.LogCodeMetrics.Get(this.ActivityContext);
            this.BuildDetail = this.ActivityContext.GetExtension<IBuildDetail>();
            string generatedFile = "Metrics.xml";
            if (this.GeneratedFileName != null && !string.IsNullOrEmpty(this.GeneratedFileName.Get(this.ActivityContext)))
                generatedFile = Path.Combine(this.BuildDetail.DropLocation, this.GeneratedFileName.Get(this.ActivityContext));

            if (!this.RunCodeMetrics(generatedFile))

Sep 14, 2012 at 2:38 AM

I have another request if someone is going to be fixing code in the CodeMetrics activity.  Is there any way it could have a setting to not mark a build as partially successful even if there are warnings?  At this point we want to know about the violations, but do not have the time to work on them at the stage we are in the project lifecycle. The other option is turning off the codemetrics activity altogether which I'd hate to do, because then we completely lose the benefits.