diff --git a/eng/azure-pipelines-nightly.yml b/eng/azure-pipelines-nightly.yml index c1817fca1..6cf27c1e0 100644 --- a/eng/azure-pipelines-nightly.yml +++ b/eng/azure-pipelines-nightly.yml @@ -10,7 +10,7 @@ steps: - task: UseDotNet@2 inputs: useGlobalJson: true - displayName: Install .NET Core SDK 8.0.100 + displayName: Install .NET Core SDK 8.0.111 - task: NuGetAuthenticate@1 displayName: Authenticate with NuGet feeds diff --git a/src/coverlet.console/Program.cs b/src/coverlet.console/Program.cs index 864df117f..2c6035ee5 100644 --- a/src/coverlet.console/Program.cs +++ b/src/coverlet.console/Program.cs @@ -34,7 +34,7 @@ static int Main(string[] args) var verbosity = new Option(new[] { "--verbosity", "-v" }, () => LogLevel.Normal, "Sets the verbosity level of the command. Allowed values are quiet, minimal, normal, detailed.") { Arity = ArgumentArity.ZeroOrOne }; var formats = new Option(new[] { "--format", "-f" }, () => new[] { "json" }, "Format of the generated coverage report.") { Arity = ArgumentArity.ZeroOrMore, AllowMultipleArgumentsPerToken = true }; var threshold = new Option("--threshold", "Exits with error if the coverage % is below value.") { Arity = ArgumentArity.ZeroOrOne }; - var thresholdTypes = new Option>("--threshold-type", () => new List(new string[] { "line", "branch", "method" }), "Coverage type to apply the threshold to.").FromAmong("line", "branch", "method"); + Option> thresholdTypes = new Option>("--threshold-type", () => new List(new string[] { "line", "branch", "method" }), "Coverage type to apply the threshold to.").FromAmong("line", "branch", "method"); var thresholdStat = new Option("--threshold-stat", () => ThresholdStatistic.Minimum, "Coverage statistic used to enforce the threshold value.") { Arity = ArgumentArity.ZeroOrOne }; var excludeFilters = new Option("--exclude", "Filter expressions to exclude specific modules and types.") { Arity = ArgumentArity.ZeroOrMore, AllowMultipleArgumentsPerToken = true }; var includeFilters = new Option("--include", "Filter expressions to include only specific modules and types.") { Arity = ArgumentArity.ZeroOrMore, AllowMultipleArgumentsPerToken = true }; @@ -106,7 +106,7 @@ static int Main(string[] args) if (string.IsNullOrEmpty(moduleOrAppDirectoryValue) || string.IsNullOrWhiteSpace(moduleOrAppDirectoryValue)) throw new ArgumentException("No test assembly or application directory specified."); - var taskStatus = await HandleCommand(moduleOrAppDirectoryValue, + int taskStatus = await HandleCommand(moduleOrAppDirectoryValue, targetValue, targsValue, outputValue, @@ -385,7 +385,6 @@ string sourceMappingFile return Task.FromResult(exitCode); - } catch (Win32Exception we) when (we.Source == "System.Diagnostics.Process") diff --git a/src/coverlet.core/Coverage.cs b/src/coverlet.core/Coverage.cs index 07c0297fa..e3957cb72 100644 --- a/src/coverlet.core/Coverage.cs +++ b/src/coverlet.core/Coverage.cs @@ -108,7 +108,7 @@ public CoveragePrepareResult PrepareModules() _parameters.IncludeFilters = _parameters.IncludeFilters?.Where(f => _instrumentationHelper.IsValidFilterExpression(f)).ToArray(); IReadOnlyList validModules = _instrumentationHelper.SelectModules(modules, _parameters.IncludeFilters, _parameters.ExcludeFilters).ToList(); - foreach (var excludedModule in modules.Except(validModules)) + foreach (string excludedModule in modules.Except(validModules)) { _logger.LogVerbose($"Excluded module: '{excludedModule}'"); } @@ -365,16 +365,6 @@ private void CalculateCoverage() { foreach (InstrumenterResult result in _results) { - if (!_fileSystem.Exists(result.HitsFilePath)) - { - // Hits file could be missed mainly for two reason - // 1) Issue during module Unload() - // 2) Instrumented module is never loaded or used so we don't have any hit to register and - // module tracker is never used - _logger.LogVerbose($"Hits file:'{result.HitsFilePath}' not found for module: '{result.Module}'"); - continue; - } - var documents = result.Documents.Values.ToList(); if (_parameters.UseSourceLink && result.SourceLink != null) { @@ -386,6 +376,16 @@ private void CalculateCoverage() } } + if (!_fileSystem.Exists(result.HitsFilePath)) + { + // Hits file could be missed mainly for two reason + // 1) Issue during module Unload() + // 2) Instrumented module is never loaded or used so we don't have any hit to register and + // module tracker is never used + _logger.LogVerbose($"Hits file:'{result.HitsFilePath}' not found for module: '{result.Module}'"); + continue; + } + // Calculate lines to skip for every hits start/end candidate // Nested ranges win on outermost one foreach (HitCandidate hitCandidate in result.HitCandidates) diff --git a/test/coverlet.tests.projectsample.aspmvcrazor/Program.cs b/test/coverlet.tests.projectsample.aspmvcrazor/Program.cs index 4088806b3..72ab4869a 100644 --- a/test/coverlet.tests.projectsample.aspmvcrazor/Program.cs +++ b/test/coverlet.tests.projectsample.aspmvcrazor/Program.cs @@ -1,12 +1,12 @@ // Copyright (c) Toni Solarin-Sodara // Licensed under the MIT license. See LICENSE file in the project root for full license information. -var builder = WebApplication.CreateBuilder(args); +WebApplicationBuilder builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorPages(); -var app = builder.Build(); +WebApplication app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment())