Skip to content

[BUG] Parameter : threshold-stat triggered error #1634

Closed
@zy8008

Description

@zy8008

when build found the following errors with ver 6.0.1 and. netcore6.0:

Unhandled exception. System.ArgumentException: Type Coverlet.Core.Enums.ThresholdStatistic cannot be created without a custom binder.
   at System.CommandLine.Binding.ArgumentConverter.CreateEnumerable(Type type, Type itemType, Int32 capacity)
   at System.CommandLine.Binding.ArgumentConverter.ConvertTokens(Argument argument, Type type, IReadOnlyList`1 tokens, LocalizationResources localizationResources, ArgumentResult argumentResult)
   at System.CommandLine.Binding.ArgumentConverter.TryConvertArgument(ArgumentResult argumentResult, Object& value)
   at System.CommandLine.Parsing.ArgumentResult.Convert(Argument argument)
   at System.CommandLine.Parsing.ArgumentResult.GetArgumentConversionResult()
   at System.CommandLine.Parsing.ParseResultVisitor.ValidateAndConvertArgumentResult(ArgumentResult argumentResult)
   at System.CommandLine.Parsing.ParseResultVisitor.ValidateAndConvertOptionResult(OptionResult optionResult)
   at System.CommandLine.Parsing.ParseResultVisitor.Stop()
   at System.CommandLine.Parsing.ParseResultVisitor.Visit(SyntaxNode node)
   at System.CommandLine.Parsing.Parser.Parse(IReadOnlyList`1 arguments, String rawInput)
   at System.CommandLine.CommandExtensions.GetDefaultInvocationPipeline(Command command, String[] args)
   at System.CommandLine.CommandExtensions.Invoke(Command command, String[] args, IConsole console)
   at Coverlet.Console.Program.Main(String[] args) in /_/src/coverlet.console/Program.cs:line 134

After checking, I found that the reason is due to the following parameters: --threshold-stat total , Restore normal after removing this parameter

Following is full command:
coverlet xxxx.Test.dll --target "dotnet" --targetargs "test ./ --no-build" --threshold 80 --threshold-type line --threshold-stat total --format opencover

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions