question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Null Exception

See original GitHub issue

Describe the bug Error: The process ‘/opt/hostedtoolcache/GitVersion.Tool/5.7.0/x64/dotnet-gitversion’ failed with exit code 1

Expected Behavior

output JSON

Actual Behavior

Error: The process ‘/opt/hostedtoolcache/GitVersion.Tool/5.7.0/x64/dotnet-gitversion’ failed with exit code 1

Possible Fix

Steps to Reproduce

Context

I can’t use gitversion in my CI/CD

Your Environment

  • Version Used: 5.x - latest
  • Operating System and version (Windows 10, Ubuntu 18.04): Ubuntu 20.04
  • Link to your project:
  • Link to your CI build (if appropriate):
  ERROR [08/27/21 3:34:09:55] An unexpected error occurred:
System.NullReferenceException: Object reference not set to an instance of an object.
   at GitVersion.GitObject..ctor(GitObject innerGitObject) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitObject.cs:line 14
   at GitVersion.Commit..ctor(Commit innerCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 15
   at GitVersion.GitRepository.<>c__DisplayClass27_0.<FindMergeBase>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 64
   at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context ctx, CancellationToken ct)
   at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)
   at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken)
   at Polly.Policy`1.Execute(Func`1 action)
   at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 37
   at GitVersion.GitRepository.FindMergeBase(ICommit commit, ICommit otherCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 62
   at GitVersion.RepositoryStore.FindMergeBase(IBranch branch, IBranch otherBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 48
   at GitVersion.RepositoryStore.<>c__DisplayClass29_0.<GetMergeCommitsForBranch>b__2(IBranch otherBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 454
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToArray()
   at System.Linq.OrderedEnumerable`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.RepositoryStore.GetMergeCommitsForBranch(IBranch branch, Config configuration, IEnumerable`1 excludedBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 438
   at GitVersion.RepositoryStore.FindCommitBranchWasBranchedFrom(IBranch branch, Config configuration, IBranch[] excludedBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 321
   at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList`1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 81
   at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(IBranch targetBranch, ICommit currentCommit, Config configuration, IList`1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 47
   at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 40
   at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs:line 38
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 17
   at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 32
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 52
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 70
  INFO [08/27/21 3:34:09:55] Attempting to show the current git graph (please include in issue): 
  INFO [08/27/21 3:34:09:55] Showing max of 100 commits
  INFO [08/27/21 3:34:09:61] * e94028f 26 minutes ago  (HEAD -> build, origin/master, master)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sanjivpurohitcommented, Apr 5, 2022

I tried the latest build and there are still more null protection required. Please let me know if you want me to open new issue. ERROR [04/04/22 21:18:52:16] An unexpected error occurred: System.NullReferenceException: Object reference not set to an instance of an object. at GitVersion.RepositoryStore.<>c.<GetMergeCommitsForBranch>b__37_3(BranchCommit b) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Core/RepositoryStore.cs:line 504 at System.Linq.EnumerableSorter2.ComputeKeys(TElement[] elements, Int32 count) at System.Linq.EnumerableSorter1.ComputeMap(TElement[] elements, Int32 count) at System.Linq.EnumerableSorter1.Sort(TElement[] elements, Int32 count) at System.Linq.OrderedEnumerable1.ToList() at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at GitVersion.RepositoryStore.GetMergeCommitsForBranch(IBranch branch, Config configuration, IEnumerable1 excludedBranches) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Core/RepositoryStore.cs:line 483 at GitVersion.RepositoryStore.FindCommitBranchWasBranchedFrom(IBranch branch, Config configuration, IBranch[] excludedBranches) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Core/RepositoryStore.cs:line 321 at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Int32 recursions, IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfigurationInternal(Int32 recursions, IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Configuration/BranchConfigurationCalculator.cs:line 54 at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Configuration/BranchConfigurationCalculator.cs:line 28 at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Core/GitVersionContextFactory.cs:line 38 at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/GitVersionCoreModule.cs:line 37 at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at System.Lazy`1.get_Value() at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/VersionCalculation/NextVersionCalculator.cs:line 15 at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/VersionCalculation/NextVersionCalculator.cs:line 30 at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.Core/Core/GitVersionCalculateTool.cs:line 52 at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in /Users/runner/work/GitVersion/GitVersion/src/GitVersion.App/GitVersionExecutor.cs:line 66 INFO [04/04/22 21:18:52:16] Attempting to show the current git graph (please include in issue): INFO [04/04/22 21:18:52:16] Showing max of 100 commits INFO [04/04/22 21:18:52:26] * 1aeae519 4 hours ago (origin/ss/ps_enum)

0reactions
github-actions[bot]commented, Apr 14, 2022

🎉 This issue has been resolved in version 5.10.0 🎉 The release is available on:

Your GitReleaseManager bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix and Avoid NullPointerException in Java
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
NullReferenceException Class (System)
The exception that is thrown when there is an attempt to dereference a null object reference.
Read more >
java - What is a NullPointerException, and how do I fix it?
NullPointerException s are exceptions that occur when you try to use a reference that points to no location in memory (null) as though...
Read more >
How to resolve the java.lang.NullPointerException
This error can be resolved by using a try-catch block or an if-else condition to check if a reference variable is null before...
Read more >
Question - Null Reference Exception (Bug or User Error?)
So im trying to figure out why this is happening. I've made sure to set my functions and variables correctly and the slots...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found