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

nbgv@v0.3 System.NullReferenceException: Object reference not set to an instance of an object. #19

Closed
edwardskrod opened this issue Mar 6, 2020 · 1 comment

Comments

@edwardskrod
Copy link
Member

I've been hitting this exception since I upgraded to aarnott/nbgv@v0.3

https://github.com/microsoft/github-actions-for-desktop-apps/blob/master/.github/workflows/ci.yml

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at LibGit2Sharp.Core.Proxy.git_commit_tree_id(ObjectHandle obj)
at LibGit2Sharp.Commit.<>c__DisplayClass11_0.<.ctor>b__0(ObjectHandle obj)
at LibGit2Sharp.Core.GitObjectLazyGroup.<>c__DisplayClass3_01.<Singleton>b__0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at Nerdbank.GitVersioning.VersionFile.GetVersion(Commit commit, String repoRelativeProjectDirectory) in D:\a\1\s\src\NerdBank.GitVersioning\VersionFile.cs:line 52
at Nerdbank.GitVersioning.GitExtensions.CommitMatchesVersion(Commit commit, SemanticVersion expectedVersion, Position comparisonPrecision, String repoRelativeProjectDirectory) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 450
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 676
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func2 selector)
at Nerdbank.GitVersioning.GitExtensions.GetCommitHeight(Commit commit, Dictionary2 heights, Func2 continueStepping) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 681
at Nerdbank.GitVersioning.GitExtensions.GetVersionHeight(Commit commit, String repoRelativeProjectDirectory, Version baseVersion) in D:\a\1\s\src\NerdBank.GitVersioning\GitExtensions.cs:line 65
at Nerdbank.GitVersioning.VersionOracle..ctor(String projectDirectory, Repository repo, Commit head, ICloudBuild cloudBuild, Nullable`1 overrideVersionHeightOffset, String projectPathRelativeToGitRepoRoot) in D:\a\1\s\src\NerdBank.GitVersioning\VersionOracle.cs:line 86
at Nerdbank.GitVersioning.Tool.Program.OnGetVersionCommand(String projectPath, String format, String singleVariable, String versionOrRef) in D:\a\1\s\src\nbgv\Program.cs:line 305
at Nerdbank.GitVersioning.Tool.Program.MainInner(String[] args) in D:\a\1\s\src\nbgv\Program.cs:line 149
--- 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 Nerdbank.GitVersioning.Tool.Program.Main(String[] args) in D:\a\1\s\src\nbgv\Program.cs:line 64
##[error]The process 'C:\Users\runneradmin.dotnet\tools\nbgv.exe' failed with exit code 3762504530

@edwardskrod
Copy link
Member Author

The problem was that I had the fetch-depth.

Checkout requirements
Git history based versioning tools rely on history being included in the clone. actions/checkout@v1 does this by default. But if you're using actions/checkout@v2 you'll need to specify deep clone:

  • uses: actions/checkout@v2
    with:
    fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

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

No branches or pull requests

1 participant