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

[Bug] NullReferenceException during dotnet-gitversion execution #2734

Closed
ENikS opened this issue Jun 17, 2021 · 12 comments · Fixed by #3064
Closed

[Bug] NullReferenceException during dotnet-gitversion execution #2734

ENikS opened this issue Jun 17, 2021 · 12 comments · Fixed by #3064
Labels
Milestone

Comments

@ENikS
Copy link

ENikS commented Jun 17, 2021

This one is a show stopper for the library. During the build we are getting NullReferenceException

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 12
   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 60
   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 42
   at GitVersion.GitRepository.FindMergeBase(ICommit commit, ICommit otherCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 58
   at GitVersion.RepositoryStore.FindMergeBase(IBranch branch, IBranch otherBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 46
   at GitVersion.RepositoryStore.<>c__DisplayClass29_0.<GetMergeCommitsForBranch>b__2(IBranch otherBranch) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 466
   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 450
   at GitVersion.RepositoryStore.FindCommitBranchWasBranchedFrom(IBranch branch, Config configuration, IBranch[] excludedBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\RepositoryStore.cs:line 328
   at GitVersion.VersionCalculation.VersionInBranchNameVersionStrategy.GetVersions(String tagPrefixRegex, IBranch currentBranch)+MoveNext() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\BaseVersionCalculators\VersionInBranchNameVersionStrategy.cs:line 41
   at GitVersion.VersionCalculation.BaseVersionCalculator.GetBaseVersions(IVersionStrategy strategy)+MoveNext() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\BaseVersionCalculator.cs:line 90
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.VersionCalculation.BaseVersionCalculator.GetBaseVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\BaseVersionCalculator.cs:line 31
   at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 58
   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 [06/17/21 19:06:23:48] Attempting to show the current git graph (please include in issue): 
  INFO [06/17/21 19:06:23:48] Showing max of 100 commits
  INFO [06/17/21 19:06:23:58] *   4cbc0d65 in the future  (HEAD -> release/5.12.0, origin/release/5.12.0)

Used GitVersion.TooL task when the problem first started, upgraded to GitVersion.MSBuild latest with no success.
Switched to Actions in hope that will fix the issue, but it is all the same.

This is the link to failing build. To reproduce, just clone branch locally.

@ENikS ENikS added the bug label Jun 17, 2021
@ENikS ENikS changed the title NullReferenceException during dotnet-gitversion execution [Bug] [Bug] NullReferenceException during dotnet-gitversion execution Jun 17, 2021
@asbjornu
Copy link
Member

I'm unable to reproduce this on my local macOS 10.15.7. I can see that the build is running on Windows, so this may be constrained to Windows. I don't think it should matter, but can you please try to upgrade to version 0.9.9 of the GitHub Actions, just to rule out the possibility?

@ENikS
Copy link
Author

ENikS commented Jun 17, 2021

@asbjornu

It reliably fails on both windows-latest and macos-latest with the same result

Did you clone this one?
https://github.com/unitycontainer/container.git 'release/5.12.0'

@asbjornu
Copy link
Member

It reliably fails on both windows-latest and macos-latest with the same

Indeed. 😕

Did you clone this one? https://github.com/unitycontainer/container.git 'release/5.12.0'

Yes. And GitVersion executes successfully:

bitbear @ BitMac ~/Dev/container on release/5.12.0
$ gitversion
{
  "Major": 5,
  "Minor": 12,
  "Patch": 0,
  "PreReleaseTag": "beta.1",
  "PreReleaseTagWithDash": "-beta.1",
  "PreReleaseLabel": "beta",
  "PreReleaseLabelWithDash": "-beta",
  "PreReleaseNumber": 1,
  "WeightedPreReleaseNumber": 30001,
  "BuildMetaData": 2,
  "BuildMetaDataPadded": "0002",
  "FullBuildMetaData": "2.Branch.release-5.12.0.Sha.4cbc0d65b09a284c6d6ccf8640ea7d5e064984e0",
  "MajorMinorPatch": "5.12.0",
  "SemVer": "5.12.0-beta.1",
  "LegacySemVer": "5.12.0-beta1",
  "LegacySemVerPadded": "5.12.0-beta0001",
  "AssemblySemVer": "5.12.0.0",
  "AssemblySemFileVer": "5.12.0.0",
  "FullSemVer": "5.12.0-beta.1+2",
  "InformationalVersion": "5.12.0-beta.1+2.Branch.release-5.12.0.Sha.4cbc0d65b09a284c6d6ccf8640ea7d5e064984e0",
  "BranchName": "release/5.12.0",
  "EscapedBranchName": "release-5-12-0",
  "Sha": "4cbc0d65b09a284c6d6ccf8640ea7d5e064984e0",
  "ShortSha": "4cbc0d6",
  "NuGetVersionV2": "5.12.0-beta0001",
  "NuGetVersion": "5.12.0-beta0001",
  "NuGetPreReleaseTagV2": "beta0001",
  "NuGetPreReleaseTag": "beta0001",
  "VersionSourceSha": "d39f240f56d54a9a1ea97eb05f15fa5a8f0610ee",
  "CommitsSinceVersionSource": 2,
  "CommitsSinceVersionSourcePadded": "0002",
  "UncommittedChanges": 0,
  "CommitDate": "2021-06-17"
}

@ENikS
Copy link
Author

ENikS commented Jun 17, 2021

I Just tried it on my local windows machine and it works:

P:\Merge\Container>..\temp\dotnet-gitversion.exe P:\Merge\Container /output json /output buildserver
INFO [06/17/21 15:26:12:67] Working directory: P:\Merge\Container
INFO [06/17/21 15:26:12:70] Project root is: P:\Merge\Container\
INFO [06/17/21 15:26:12:70] DotGit directory is: P:\Merge\Container\.git
INFO [06/17/21 15:26:12:73] Begin: Loading version variables from disk cache
  INFO [06/17/21 15:26:12:73] Cache file P:\Merge\Container\.git\gitversion_cache\B680964BA6547DA8B43DA17A6C37521E21EDEB6C.yml not found.
  INFO [06/17/21 15:26:12:73] End: Loading version variables from disk cache (Took: 3.46ms)
  INFO [06/17/21 15:26:12:74] Using latest commit on specified branch
  INFO [06/17/21 15:26:12:79] Running against branch: release/5.12.0 (073b98d Run on mac)
  INFO [06/17/21 15:26:12:79] Begin: Calculating base versions
    INFO [06/17/21 15:26:12:83] Fallback base version: 0.1.0 with commit count source 5222961455745e75c2a93039b26005c99f8ea208
    INFO [06/17/21 15:26:12:86] Found commit [073b98d Run on mac] matching merge message format: Default
    INFO [06/17/21 15:26:12:86] Found commit [073b98d Run on mac] matching merge message format: Default
    INFO [06/17/21 15:26:12:89] Found commit [073b98d Run on mac] matching merge message format: Default
    INFO [06/17/21 15:26:12:89] Found commit [073b98d Run on mac] matching merge message format: Default
    INFO [06/17/21 15:26:12:91] Merge message 'Merge branch 'release/5.12.0' of https://github.com/unitycontainer/container into release/5.12.0': 5.12.0 with commit count source 4cbc0d65b09a284c6d6ccf8640ea7d5e064984e0
    INFO [06/17/21 15:26:12:91] Merge message 'Merge branch 'release/5.12.0' of https://github.com/unitycontainer/container into release/5.12.0

# Conflicts:
#       package.props
#       package.sln
#       src/Unity.Container.csproj
#       tests/Regression/Tests.Regression.csproj
#       tests/Unit/Tests.Unit.csproj
#       tests/Unit/Unity.Container.Tests.csproj
#       tests/Unity.Tests/Unity.Tests.csproj': 5.12.0 with commit count source d39f240f56d54a9a1ea97eb05f15fa5a8f0610ee
    INFO [06/17/21 15:26:12:91] Merge message 'Merge branch 'release/5.11' of https://github.com/unitycontainer/container into release/5.11': 5.11.0 with commit count source ef5665e488facf23d1463140a49c30e09acd084a
    INFO [06/17/21 15:26:12:91] Merge message 'Merge branch 'release/5.11' of https://github.com/unitycontainer/container into release/5.11': 5.11.0 with commit count source e1585c2e48881e14d2bb3271facadf43c510f448
    INFO [06/17/21 15:26:12:94] Git tag '5.11.10.1193': 5.11.10+1193 with commit count source 07df2796aaca8c41384f4847b89728eaa31ae79c
    INFO [06/17/21 15:26:12:94] Git tag '5.11.9.1190': 5.11.9+1190 with commit count source e65799e27345ddcad987685f14fb80ef9ac9f2cb
    INFO [06/17/21 15:26:12:95] Git tag '5.11.8.1183': 5.11.8+1183 with commit count source 781124f71113d4c7d3a81040e328eeac507fec3a
    INFO [06/17/21 15:26:12:95] Git tag '5.11.7.1167': 5.11.7+1167 with commit count source 009be65f835ecc3c2babd55cf79696649a7ce53b
    INFO [06/17/21 15:26:12:95] Git tag 'v5.11.4': 5.11.4 with commit count source aa8d9acd0c906a5544ff60275dc1ab0a7741043c
    INFO [06/17/21 15:26:12:95] Git tag '5.11.1.987': 5.11.1+987 with commit count source 626e5550a8f5be33f170ccf48561e06d76ae2e1c
    INFO [06/17/21 15:26:12:95] Git tag '5.10.3.856': 5.10.3+856 with commit count source 5b8fc819590db98a6289efa95ff9327335841610
    INFO [06/17/21 15:26:12:95] Git tag '5.10.2.847': 5.10.2+847 with commit count source ef49343b9dbe6ebf4ad9b759e6f2cff8606f27ac
    INFO [06/17/21 15:26:12:95] Git tag '5.10.1.840': 5.10.1+840 with commit count source 874b115c9b7d134dd2e5cb5bce27c3acb46f6ef5
    INFO [06/17/21 15:26:12:96] Git tag '5.10.0.834': 5.10.0+834 with commit count source 9008f8990f7b4e20afa24cd799fa842f513e1341
    INFO [06/17/21 15:26:12:96] Git tag '5.9.8.830': 5.9.8+830 with commit count source b54ab74eb7127910270421d02f4ede33dde14b34
    INFO [06/17/21 15:26:12:96] Git tag '5.9.7.822': 5.9.7+822 with commit count source 29c3e27f1b0957a11de19fc52c902c877300b793
    INFO [06/17/21 15:26:12:96] Git tag '5.9.6.820': 5.9.6+820 with commit count source f47b8d0556d8d135f3973d16ac68be090db6dbc7
    INFO [06/17/21 15:26:12:96] Git tag '5.9.5.816': 5.9.5+816 with commit count source 4d4f58880118f7cdf5edc3b9fd317406d11aa087
    INFO [06/17/21 15:26:12:96] Git tag '5.9.4.812': 5.9.4+812 with commit count source 02876428dbd63f32837146c3bac8418fdebe8710
    INFO [06/17/21 15:26:12:97] Git tag '5.9.2.797': 5.9.2+797 with commit count source a1f2bb4ea771a058438708024c0946f437f8b7de
    INFO [06/17/21 15:26:12:97] Git tag '5.9.1.788': 5.9.1+788 with commit count source a2fc21587f55b09ed15f3282de96c5dc1fea4467
    INFO [06/17/21 15:26:12:97] Git tag '5.9.0.784': 5.9.0+784 with commit count source d4e5932867f9f624216f1ac30f3712ceffdc65a6
    INFO [06/17/21 15:26:12:97] Git tag '5.8.12.669': 5.8.12+669 with commit count source 818fac74a4bfa840c45c542a882036609cae0c9a
    INFO [06/17/21 15:26:12:97] Git tag '5.8.11.618': 5.8.11+618 with commit count source 54f930354ee68160ee5d45879752a82858940596
    INFO [06/17/21 15:26:12:97] Git tag '5.8.10.605': 5.8.10+605 with commit count source 7e67d263015eb9db5b372ac0be15d99897a812e5
    INFO [06/17/21 15:26:12:97] Git tag '5.8.9.593': 5.8.9+593 with commit count source a1a4c69ddd54eb510f175769fd6ce05a6250c57f
    INFO [06/17/21 15:26:12:98] Git tag '5.8.8.591': 5.8.8+591 with commit count source 77d261b626370adeab3f224c6bb000e9bb21f986
    INFO [06/17/21 15:26:12:98] Git tag '5.8.7.586': 5.8.7+586 with commit count source 4fa711a64bfd1d0a5e1382df5c1f72229b5f68f7
    INFO [06/17/21 15:26:12:98] Git tag '5.8.6.568': 5.8.6+568 with commit count source 197de302a3dbd4c3a1007da3e850ac7dae26e985
    INFO [06/17/21 15:26:12:98] Git tag '5.8.5.551': 5.8.5+551 with commit count source 5c11cfb8625e20762def789c6efcb248297bbc06
    INFO [06/17/21 15:26:12:98] Git tag '5.8.4.544': 5.8.4+544 with commit count source 2c6730391b7425ebec64c75f4cc3c72bd119cf3a
    INFO [06/17/21 15:26:12:98] Git tag '5.8.3.537': 5.8.3+537 with commit count source 3d1b0d3414e6f787b979868b0a159a3b4563e590
    INFO [06/17/21 15:26:12:98] Git tag '5.8.2.533': 5.8.2+533 with commit count source f2fe057a39a11281cca38c4701c3b7056ccbc981
    INFO [06/17/21 15:26:12:98] Git tag '5.8.1.522': 5.8.1+522 with commit count source 7ae61755663a766f77a938fc867b81234d681103
    INFO [06/17/21 15:26:12:99] Git tag '5.8.0.519': 5.8.0+519 with commit count source 69f3af9ac507264381e550a7b46ed821e77a6af5
    INFO [06/17/21 15:26:12:99] Git tag '5.7.4.513': 5.7.4+513 with commit count source 9fc07e5973701d761d01ee5fa34cd42b1df5b9fd
    INFO [06/17/21 15:26:12:99] Git tag '5.7.3.487': 5.7.3+487 with commit count source 7ee44ca8bcd1c21898fe4a463a073b3900b75335
    INFO [06/17/21 15:26:12:99] Git tag '5.7.0.473': 5.7.0+473 with commit count source d0fe59c6ad8ca4558dbf1ff4804bb24301473e43
    INFO [06/17/21 15:26:12:99] Git tag '5.6.1.380': 5.6.1+380 with commit count source 77d10e1296994e56ad4c6d7014333362548962ab
    INFO [06/17/21 15:26:12:99] Git tag '5.5.8.365': 5.5.8+365 with commit count source 7b1f3108dab841ab3b899389f7c03a2376adbddf
    INFO [06/17/21 15:26:12:99] Git tag '5.5.7.362': 5.5.7+362 with commit count source 393b3526b2a39dfe44db1d72d4c93012622fd594
    INFO [06/17/21 15:26:12:99] Git tag '5.5.6.359': 5.5.6+359 with commit count source 2dcea058e66da51af1f69173af01523a3d589b53
    INFO [06/17/21 15:26:12:99] Git tag '5.5.5.355': 5.5.5+355 with commit count source feb806648d2d49e003242c6db806e7d8e2539b12
    INFO [06/17/21 15:26:12:99] Git tag '5.5.3.353': 5.5.3+353 with commit count source 73d8717f0530de33a12b1d97305e5efff7b7eed9
    INFO [06/17/21 15:26:13:00] Git tag '5.5.2.350': 5.5.2+350 with commit count source 8b5e74b65f1947229a3d4cc089009b591a878d93
    INFO [06/17/21 15:26:13:00] Git tag '5.5.1.342': 5.5.1+342 with commit count source 2fa1fa9e30efb4c5e0437b9028a805e3b94cfb0b
    INFO [06/17/21 15:26:13:00] Git tag '5.5.0.330': 5.5.0+330 with commit count source 578dd06790c702efac5183384a950f23f6748372
    INFO [06/17/21 15:26:13:00] Git tag '5.4.0.318': 5.4.0+318 with commit count source 9546d3dd2d33c8c791d9f289fb234fc5bcfa93bd
    INFO [06/17/21 15:26:13:00] Git tag '5.3.2.281': 5.3.2+281 with commit count source 0d49159c40a60ab87dad14f733b37d816680b5e1
    INFO [06/17/21 15:26:13:00] Git tag '5.3.1.266': 5.3.1+266 with commit count source 142457269b7818d03b2feb9af23f09c9107893ce
    INFO [06/17/21 15:26:13:00] Git tag '5.3.0.254': 5.3.0+254 with commit count source f9a80eb331fdb37313413b0219e925b0deda42f3
    INFO [06/17/21 15:26:13:01] Git tag '5.2.1.235': 5.2.1+235 with commit count source 980124213785b5f726210bf7efa50affa769d907
    INFO [06/17/21 15:26:13:01] Git tag '5.2.0.216': 5.2.0+216 with commit count source 550e97b8a14e5bc1f5097a69feab18ac0d131921
    INFO [06/17/21 15:26:13:01] Git tag '5.1.0.200': 5.1.0+200 with commit count source ab6705e48a006f823dc88ca27274968977c1b5a3
    INFO [06/17/21 15:26:13:01] Git tag 'v5.0.1': 5.0.1 with commit count source 9b528f03daf7ccd3752b0521aacada52027f5e1a
    INFO [06/17/21 15:26:13:01] Git tag '5.0.0': 5.0.0 with commit count source 3e3440263651c6916bdf5332736f30ad2154ec52
    INFO [06/17/21 15:26:13:01] Begin: Finding branch source of 'release/5.12.0'
    INFO [06/17/21 15:26:13:04] End: Finding branch source of 'release/5.12.0' (Took: 24.17ms)
    INFO [06/17/21 15:26:13:04] Version in branch name: 5.12.0 with commit count source External Source
    INFO [06/17/21 15:26:13:08] Found multiple base versions which will produce the same SemVer (5.12.0), taking oldest source for commit counting (Merge message 'Merge branch 'release/5.12.0' of https://github.com/unitycontainer/container into release/5.12.0

# Conflicts:
#       package.props
#       package.sln
#       src/Unity.Container.csproj
#       tests/Regression/Tests.Regression.csproj
#       tests/Unit/Tests.Unit.csproj
#       tests/Unit/Unity.Container.Tests.csproj
#       tests/Unity.Tests/Unity.Tests.csproj')
    INFO [06/17/21 15:26:13:08] Base version used: Merge message 'Merge branch 'release/5.12.0' of https://github.com/unitycontainer/container into release/5.12.0

# Conflicts:
#       package.props
#       package.sln
#       src/Unity.Container.csproj
#       tests/Regression/Tests.Regression.csproj
#       tests/Unit/Tests.Unit.csproj
#       tests/Unit/Unity.Container.Tests.csproj
#       tests/Unity.Tests/Unity.Tests.csproj': 5.12.0 with commit count source d39f240f56d54a9a1ea97eb05f15fa5a8f0610ee
  INFO [06/17/21 15:26:13:08] End: Calculating base versions (Took: 286.37ms)
  INFO [06/17/21 15:26:13:08] 5 commits found between d39f240 Merge branch 'release/5.12.0' of https://github.com/unitycontainer/container into release/5.12.0 and 073b98d Run on mac
  INFO [06/17/21 15:26:13:08] Skipping version increment
  INFO [06/17/21 15:26:13:08] 5 commits found between d39f240 Merge branch 'release/5.12.0' of https://github.com/unitycontainer/container into release/5.12.0 and 073b98d Run on mac
  INFO [06/17/21 15:26:13:09] Begin: Getting version tags from branch 'refs/heads/release/5.12.0'.
  INFO [06/17/21 15:26:13:10] End: Getting version tags from branch 'refs/heads/release/5.12.0'. (Took: 17.75ms)
  INFO [06/17/21 15:26:13:11] Begin: Creating dictionary
  INFO [06/17/21 15:26:13:11] End: Creating dictionary (Took: 4.51ms)
  INFO [06/17/21 15:26:13:15] Begin: Storing version variables to cache file P:\Merge\Container\.git\gitversion_cache\B680964BA6547DA8B43DA17A6C37521E21EDEB6C.yml
  INFO [06/17/21 15:26:13:19] End: Storing version variables to cache file P:\Merge\Container\.git\gitversion_cache\B680964BA6547DA8B43DA17A6C37521E21EDEB6C.yml (Took: 43.06ms)
{
  "Major": 5,
  "Minor": 12,
  "Patch": 0,
  "PreReleaseTag": "beta.1",
  "PreReleaseTagWithDash": "-beta.1",
  "PreReleaseLabel": "beta",
  "PreReleaseLabelWithDash": "-beta",
  "PreReleaseNumber": 1,
  "WeightedPreReleaseNumber": 30001,
  "BuildMetaData": 5,
  "BuildMetaDataPadded": "0005",
  "FullBuildMetaData": "5.Branch.release-5.12.0.Sha.073b98d0c5960cd5d03315af0c581e803d89c6b7",
  "MajorMinorPatch": "5.12.0",
  "SemVer": "5.12.0-beta.1",
  "LegacySemVer": "5.12.0-beta1",
  "LegacySemVerPadded": "5.12.0-beta0001",
  "AssemblySemVer": "5.12.0.0",
  "AssemblySemFileVer": "5.12.0.0",
  "FullSemVer": "5.12.0-beta.1+5",
  "InformationalVersion": "5.12.0-beta.1+5.Branch.release-5.12.0.Sha.073b98d0c5960cd5d03315af0c581e803d89c6b7",
  "BranchName": "release/5.12.0",
  "EscapedBranchName": "release-5-12-0",
  "Sha": "073b98d0c5960cd5d03315af0c581e803d89c6b7",
  "ShortSha": "073b98d",
  "NuGetVersionV2": "5.12.0-beta0001",
  "NuGetVersion": "5.12.0-beta0001",
  "NuGetPreReleaseTagV2": "beta0001",
  "NuGetPreReleaseTag": "beta0001",
  "VersionSourceSha": "d39f240f56d54a9a1ea97eb05f15fa5a8f0610ee",
  "CommitsSinceVersionSource": 5,
  "CommitsSinceVersionSourcePadded": "0005",
  "UncommittedChanges": 1,
  "CommitDate": "2021-06-17"
}
  INFO [06/17/21 15:26:13:23] Done writing

@ENikS
Copy link
Author

ENikS commented Jun 17, 2021

The only difference I see is this:

    steps:

    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

@pavelmateju
Copy link

Same for us.

Windows version:

CurrentBuild: 19042
UBR: 1052
ReleaseId: 2008
CompositionEditionID: Enterprise

using gitversion installed as:

dotnet tool install --global GitVersion.Tool --version 5.6.10

  1. dotnet-gitversion.exe /? work fine

  2. dotnet-gitversion.exe /output throwing

"Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at GitVersion.ArgumentParser.ParseOutput(Arguments arguments, String[] values) in D:\a\GitVersion\GitVersion\src\GitVersion.App\ArgumentParser.cs:line 401 .............................."

  1. tried to downgrade gitversion to 5.6.09 - still same error

  2. Was working before - looks like it appeared with recent windows update.

@asbjornu
Copy link
Member

asbjornu commented Jul 2, 2021

The only difference I see is this:

    steps:

    - name: Checkout
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

If you don't have fetch-depth: 0 in the failing build, that may explain it. As stated in the requirements, GitVersion does not work with shallow repositories.

@ENikS
Copy link
Author

ENikS commented Jul 3, 2021

I included a link to failing build where you can clearly see correct step included.

Local run, without the deep fetch succeeds.

@asbjornu
Copy link
Member

asbjornu commented Mar 3, 2022

@pavelmateju, your problem is that the /output argument is missing a value. It failing with a NullReferenceException is a bug, but if you add /output json it works.

@pavelmateju
Copy link

@asbjornu ,

Yes you are right. My bad. This is another bug. Thank you !

As soon as you specified correct value or even some value you get expected result.

@asbjornu
Copy link
Member

asbjornu commented Mar 4, 2022

Glad you got it working, @pavelmateju! The current argument parser and entire CLI is leaving much to be wanted and can't be much improved without rewriting it from scratch – something we plan to do in v6 (see #2275 for details).

@asbjornu asbjornu mentioned this issue Apr 2, 2022
5 tasks
@asbjornu asbjornu added this to the 5.x milestone Apr 2, 2022
@arturcic arturcic modified the milestones: 5.x, 5.10.0 Apr 14, 2022
@github-actions
Copy link

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

Your GitReleaseManager bot 📦🚀

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.

4 participants