Open EMI0101 opened 1 year ago
I'm trying to switch to V2 and have this same issue. It looks like it is trying to access a directory that doesn't exist.
--reportDirectory
was a parameter in V1 but does not exist in V2. The task is adding the --reportDirectory
parameter to a directory that doesn't exist.
Looks like a dup of #17756.
Agents on 3.218.0 and switched them to .net 7 identical issue persists.
How is this not fixed, Azure just doesn't have working coverage for months ?
Everyone still uses the old version? Baffling.
Same issue
Starting: PublishCodeCoverageResults
==============================================================================
Task : Publish code coverage results v2
Description : Publish any of the code coverage results from a build
Version : 2.218.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
==============================================================================
Found 1 result(s) matching pattern: **/code-coverage.xml
D:\a\1\s\AgilityPlanning.UI\ClientApp\testresults\coverage\code-coverage.xml
"C:\Program Files\dotnet\dotnet.exe" D:\a\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.218.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.dll "D:\a\1\s\AgilityPlanning.UI\ClientApp\testresults\coverage\code-coverage.xml" --reportDirectory D:\a\_temp\87bea6ad-fe11-43e3-bd08-bd55bbde32bd
Welcome to .NET 7.0!
---------------------
SDK Version: 7.0.203
Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.Cli.Utils.EnvironmentProvider.get_ExecutableExtensions()
at Microsoft.DotNet.Cli.Utils.EnvironmentProvider.GetCommandPathFromRootPath(String rootPath, String commandName, String[] extensions)
at Microsoft.DotNet.CommandFactory.AbstractPathBasedCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CompositeCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CommandFactoryUsingResolver.Create(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Finishing: PublishCodeCoverageResults
Still broken.
I am experiencing this same issue.
Using V2 of the publish code coverage results task results in the following:
Starting: Publish code coverage results
==============================================================================
Task : Publish code coverage results v2
Description : Publish any of the code coverage results from a build
Version : 2.221.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
==============================================================================
Found 1 result(s) matching pattern: MyPath\coverage\*.xml
C:\agent\_work\3\s\MayPath\coverage\cobertura-coverage.xml
"C:\Program Files\dotnet\dotnet.exe" C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.221.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.dll "C:\agent\_work\3\s\ActiveH\ActiveH Web\ActiveHWeb.Angular\coverage\cobertura-coverage.xml" --reportDirectory C:\agent\_work\_temp\4f772f7e-0ea6-4942-afc0-654650be06bd --sourceDirectory C:\agent\_work\3\s\ActiveH\ActiveH Web\ActiveHWeb.Angular
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.Cli.Utils.EnvironmentProvider.get_ExecutableExtensions()
at Microsoft.DotNet.Cli.Utils.EnvironmentProvider.GetCommandPathFromRootPath(String rootPath, String commandName, String[] extensions)
at Microsoft.DotNet.CommandFactory.AppBaseCommandResolver.ResolveCommandPath(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.AbstractPathBasedCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CompositeCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CommandResolver.TryResolveCommandSpec(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
at Microsoft.DotNet.CommandFactory.CommandFactoryUsingResolver.Create(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
Finishing: Publish code coverage results
This is in a classic build pipeline (has to be classic, as we are still using TFVC) trying to publish cobertura coverage results produced by a previous npm (karma) step in the pipeline.
Running Azure DevOps Services with a locally hosted agent.
We also experience this issue with our builds with a similar signature:
Found 1 result(s) matching pattern: **/coverage/cobertura-coverage.xml
C:\agent\_work\7\s\coverage\cobertura-coverage.xml
"C:\Program Files\dotnet\dotnet.exe" C:\agent\_work\_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\2.221.0\node_modules\coveragepublisher\CoveragePublisher\CoveragePublisher.Console.dll "C:\agent\_work\7\s\coverage\cobertura-coverage.xml" --reportDirectory C:\agent\_work\_temp\1b094c04-0148-4f7d-a08f-1a9fed482402
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.Cli.Utils.EnvironmentProvider.get_ExecutableExtensions()
at Microsoft.DotNet.Cli.Utils.EnvironmentProvider.GetCommandPathFromRootPath(String rootPath, String commandName, String[] extensions)
at Microsoft.DotNet.CommandFactory.AbstractPathBasedCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CompositeCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.CommandFactory.CommandFactoryUsingResolver.Create(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
I've found a resolution (or a workaround depending on your point of view) to our issue:
The V2 of the publish code coverage results task (classic pipeline) has two path fields:
1) Path to summary files (summaryFileLocation) 2) Path to source files (pathToSources)
If the path to source files is left blank, then the System.NullReferenceException occurs. If the path to source files is explicitly specified, then the code coverage results are published correctly. In our case it is now set to:
$(System.DefaultWorkingDirectory)\MyPath
It appears that the task is not able to interpret the following root path from the cobertura-coverage.xml file correctly:
<sources>
<source>C:\agent\_work\3\s\MyPath</source>
</sources>
To be fair, the info provided for this field does clearly state:
"Path to source files is required when coverage XML reports do not contain absolute path to source files. For e.g., JaCoCo reports do not use absolute paths and when publishing JaCoCo coverage for Java apps, the pattern would be similar to $(System.DefaultWorkingDirectory)/MyApp/src/main/java/"
Mentions nothing about cobertura though...
The proper fix for MS would be to either support the
One other word of warning: The Path to source files cannot contain a space - this throws things out completely. We have to rename the problem directory first, publish the results, and then rename back. Other 'logical' workarounds like creating a symbolic link or using the 8.3 path name don't work.
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
Not fixed, using jbatmis workaround.
Task name
PublishCodeCoverageResultsV2
Task version
2.218.0
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows 11
Task log
Relevant log output
Aditional info