dependabot / dependabot-core

🤖 Dependabot's core logic for creating update PRs.
https://docs.github.com/en/code-security/dependabot
MIT License
4.65k stars 999 forks source link

Nuget System.ArgumentException: Value cannot be null or an empty string. (Parameter 'value') #9804

Open a-jackson opened 4 months ago

a-jackson commented 4 months ago

Is there an existing issue for this?

Package ecosystem

Nuget

Package manager version

No response

Language version

.Net 8.0

Manifest location and content before the Dependabot update

No response

dependabot.yml content

No response

Updated dependency

QuestPDF from 2024.3.6 to 2024.3.7

What you expected to see, versus what you actually saw

Expected a PR with the update but it throws an error. We're using central package management but it works with other dependencies. There's this and a couple of other packages have the same problem but everything else works.

Native package manager behavior

No response

Images of the diff or a link to the PR, issue, or logs

Stack trace

``` updater | Updating project [/home/dependabot/dependabot-updater/repo/src/processor/services/Reporting/Reporting.csproj] updater | Running for SDK-style project updater | Found incorrect [PackageVersion] version attribute in [Directory.Packages.props]. updater | Unhandled exception: System.ArgumentException: Value cannot be null or an empty string. (Parameter 'value') updater | at NuGet.Versioning.NuGetVersion.Parse(String value) in /opt/nuget/lib/NuGet.Client/src/NuGet.Core/NuGet.Versioning/NuGetVersionFactory.cs:line 21 updater | at NuGetUpdater.Core.SdkPackageUpdater.TryUpdateDependencyVersion(ImmutableArray`1 buildFiles, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Logger logger) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs:line 402 updater | at NuGetUpdater.Core.SdkPackageUpdater.UpdateTopLevelDepdendency(String repoRootPath, ImmutableArray`1 buildFiles, String[] targetFrameworks, String dependencyName, String previousDependencyVersion, String newDependencyVersion, IDictionary`2 peerDependencies, Logger logger) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs:line 344 updater | at NuGetUpdater.Core.SdkPackageUpdater.UpdateDependencyAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive, Logger logger) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs:line 44 updater | at NuGetUpdater.Core.UpdaterWorker.RunUpdaterAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 143 updater | at NuGetUpdater.Core.UpdaterWorker.RunForProjectAsync(String repoRootPath, String projectPath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 115 updater | at NuGetUpdater.Core.UpdaterWorker.RunAsync(String repoRootPath, String workspacePath, String dependencyName, String previousDependencyVersion, String newDependencyVersion, Boolean isTransitive) in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs:line 40 updater | at NuGetUpdater.Cli.Commands.UpdateCommand.<>c__DisplayClass7_0.<b__0>d.MoveNext() in /opt/nuget/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs:line 37 updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context) updater | at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<b__0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<b__0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<b__0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<b__0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__18_0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__5_0>d.MoveNext() updater | --- End of stack trace from previous location --- updater | at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<b__0>d.MoveNext(): ```

Smallest manifest that reproduces the issue

No response

brettfo commented 4 months ago

Could you share a repo/project or a log file that shows this error?

a-jackson commented 4 months ago

I've tried to make a minimal reproduction of this but I can't get it to fail, it's a private repository we're seeing it in so I can't link it. The relevant section of the log is in a detail block above, the entire log is 41000 lines and I'm not sure it if contains private things I shouldn't be publishing.

I did some investigation, the value causing the exception appears to have a null check so I would assume it is empty. It seems to be related to changes in #9507. I tried running the NugetUpdater.Cli locally matching the command in the log /opt/nuget/NuGetUpdater/NuGetUpdater.Cli update --repo-root /home/dependabot/dependabot-updater/repo --solution-or-project /home/dependabot/dependabot-updater/repo/src/processor/services/Reporting/Reporting.csproj --dependency QuestPDF --new-version 2024.3.7 --previous-version 2024.3.6 --verbose but it doesn't update anything.