Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: projectDirectory cannot be an empty string #573

Closed
heaths opened this issue Mar 28, 2021 · 0 comments · Fixed by #574
Closed

Regression: projectDirectory cannot be an empty string #573

heaths opened this issue Mar 28, 2021 · 0 comments · Fixed by #574
Assignees
Labels
Milestone

Comments

@heaths
Copy link
Contributor

heaths commented Mar 28, 2021

In nbgv vv3.3.37+0989e8fe0c you could just run: nbgv set-version 1.2.3

Built against master, that now throws an exception (which was causing me to re-evaluate my unrelated code changes for #567):

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: 'projectDirectory' cannot be an empty string ("") or start with the null character.
Parameter name: projectDirectory
   at Validation.Requires.NotNullOrEmpty(String value, String parameterName)
   at Nerdbank.GitVersioning.VersionFile.SetVersion(String projectDirectory, VersionOptions version, Boolean includeSchemaProperty) in C:\src\Nerdbank.GitVersioning\src\NerdBank.GitVersioning\VersionFile.cs:line 77
   at Nerdbank.GitVersioning.Tool.Program.OnSetVersionCommand(String projectPath, String version) in C:\src\Nerdbank.GitVersioning\src\nbgv\Program.cs:line 409
   at Nerdbank.GitVersioning.Tool.Program.MainInner(String[] args) in C:\src\Nerdbank.GitVersioning\src\nbgv\Program.cs:line 169
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Nerdbank.GitVersioning.Tool.Program.Main(String[] args) in C:\src\Nerdbank.GitVersioning\src\nbgv\Program.cs:line 76

Debugging into this, it appear that the searchDirectory is never set to anything other than "" which defaults to the GitContext.RepoRelativeProjectDirectory. The version.json file is still found, but the directory in which it was found is no longer set for the out param, and a subsequent null-or-empty check throws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants