flow.
"Flow is a condition of deep, nearly meditative involvement." - Tom DeMarco

MbUnit NAnt Task – System.ArgumentNullException Solution

Monday, July 14, 2008 2:28 PM

This is as much for me as for everyone else since I seem to encounter this problem with every new project.

If you’ve added the custom MbUnit NAnt task (found in MbUnit.Tasks.dll) to your NAnt script but receive the following stack trace when you run…

System.ArgumentNullException: Value cannot be null.
Parameter name: path
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.Path.GetFullPath(String path)
   at MbUnit.Core.ResourceHelper.CreateImages(String path)
   at MbUnit.Core.Reports.HtmlReport.RenderToHtml(ReportResult result, String outputPath, String transform, String nameFormat)
   at MbUnit.Core.Reports.HtmlReport.RenderToHtml(ReportResult result, String outputPath, String nameFormat)
   at MbUnit.Tasks.MbUnitTask.GenerateReports()
   at MbUnit.Tasks.MbUnitTask.ExecuteTask()
   at NAnt.Core.Task.Execute()
   at NAnt.Core.Target.Execute()
   at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
   at NAnt.Core.Project.Execute()
   at NAnt.Core.Project.Run()

Then you need to add the “report-types” attribute to your build file and specify “XML” which will overload the default setting of “HTML”.  You can find an example in the task below…

<target name="test" depends="build">
  <mbunit report-types="xml">
    <assemblies>
      <includes asis="true" name=".\Matrix.Controllers.UnitTests\bin\debug\Matrix.Controllers.UnitTests.dll"/>
    </assemblies>
  </mbunit>
</target>


Feedback

# re: MbUnit NAnt Task – System.ArgumentNullException Solution

Or use the Gallio runners... 7/14/2008 7:28 PM | Jeff Brown

# re: MbUnit NAnt Task – System.ArgumentNullException Solution

Thanks for the tip, Jeff! 7/14/2008 9:22 PM | Jeremy

Post a comment





 

Please add 2 and 8 and type the answer here: