Skip to content

[Bug]Null Exception #3068

@sanjivpurohit

Description

@sanjivpurohit

Describe the bug
Null Exception.
I am trying to generate a version on the branch. It works on the master.

Expected Behavior

Version must be generated.

Actual Behavior

Crashes with an exception

Possible Fix

Steps to Reproduce

Context

Your Environment

  • Version Used: gitversion-osx-arm64-5.9.1-beta1-43
  • Operating System and version (Windows 10, Ubuntu 18.04): Mac/Linux
  • Link to your project:
  • Link to your CI build (if appropriate):
  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.EnumerableSorter`2.ComputeKeys(TElement[] elements, Int32 count)
   at System.Linq.EnumerableSorter`1.ComputeMap(TElement[] elements, Int32 count)
   at System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count)
   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 /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, IList`1 excludedInheritBranches)
   at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfigurationInternal(Int32 recursions, IBranch targetBranch, ICommit currentCommit, Config configuration, IList`1 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, IList`1 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.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.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)

@asbjornu Thanks for fixing the previous null exception and this is a new one with the latest build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions