NCover Documentation

When NCover.Reporting is run under the Local System account, such as by a script, by a build server, or as part of an automated build or testing process, it may generate an error and fail to create reports.

Common Scenarios

Users who have reported this issue to us are commonly using NCover with TeamCity's .NET Coverage feature, and have set TeamCity to run under the Local System account. In such a scenario, NCover.Reporting fails to generate HTML or XML reports and users find errors in the TeamCity build log related to NCover.Reporting.

Possible Errors

Users experiencing this problem may receive the following error:

Error: -------------------------------------------------------------------------------
---- Top level exception: System.Exception
An error occurred while loading your coverage file: The directory name is invalid.

   at NCover.Framework.Reports.ReportingProcessor.CreateCoverageView(List`1 filenames, ICoverageReportSettings sett, String outputPath)
   at NCover.Framework.Reports.ReportingProcessor.Process()
   at NCover.Reporting.ReportMain.RunReport(String[] args, IOutputWriter output)

---- Inner exception: System.IO.IOException
The directory name is invalid.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Path.GetTempFileName()
   at NCover.Framework.Utilities.CoverageLoader.Merge(ICoverageView originalView, List`1 paths, MergeFilterMode mode, NCoverCoverageFileFormat coverageFormat, String outputPath)
   at NCover.Framework.Utilities.CoverageLoader.Merge(List`1 paths, MergeFilterMode mode, NCoverCoverageFileFormat coverageFormat, String outputPath)
   at NCover.Framework.Reports.ReportingProcessor.CreateCoverageView(List`1 filenames, ICoverageReportSettings sett, String outputPath)
-------------------------------------------------------------------------------

Cause

The cause of this issue relates to the Local System's temporary file path and %USERPROFILE% environment variables. When NCover.Reporting loads a coverage file to process, several temporary files are created in the temporary folder specified by the user's environment variables. When NCover.Reporting is run under the Local System account, the temporary file path is sometimes not present, and creation of the reports fails.

Suggested Resolution

If you are experiencing errors when using NCover.Reporting under the Local System account, you should verify that the temporary file path specified for the Local System is valid. Assuming that environment variables have their default settings and that Windows is installed on the 'C' drive, the following paths should exist:

Windows Server 2003, Windows XP : C:\Windows\system32\config\systemprofile\Local Settings\Temp
Windows Server 2008, Windows 7, Windows Vista: C:\Windows\system32\config\systemprofile\AppData\Local\Temp

In most cases, the "Temp" folder is missing and should be created. If creating the "Temp" folder does not correct this issue, or the folder already exists but the issue continues to occur, please contact our support team.

If you still need technical assistance, we can help:

Submit A Support Ticket

Try NCover Free Contact Us Online