actions
actions copied to clipboard
SyntaxError: Unexpected end of JSON input
Hi
We have been using the GitTools task in Azure DevOps happily for over 2 years and it has been working great. Then all of a sudden a few days ago it has started failing with the following error: "SyntaxError: Unexpected end of JSON input".
Strangely the error seems to only occur in any newly created pipelines, any existing pipelines (prior to a few days ago) in the same repo/branch, it carries on working fine.
The error is raised when we run the following task:
- task: gitversion/execute@0 displayName: 'Execute GitVersion' inputs: useConfigFile: false
The "gitversion/setup@0"task is downloading and using GitVersion 5.10.3, and the version has not changed recently. I believe 5.10.3 is the latest version.
Tool 'gitversion.tool' (version '5.10.3') was successfully installed. Caching tool: GitVersion.Tool 5.10.3 x64
Any help with this would be greatly appreciated. We have not changed anything with our pipeline/repo implementation/configuration, so we are stumped to why it has suddenly stopped working.
The full log of the task is here:
2022-09-08T06:44:49.7153411Z ##[section]Starting: Execute GitVersion
2022-09-08T06:44:49.7293159Z ==============================================================================
2022-09-08T06:44:49.7293544Z Task : Execute GitVersion Task
2022-09-08T06:44:49.7293855Z Description : Easy Semantic Versioning (http://semver.org) for projects using Git
2022-09-08T06:44:49.7294129Z Version : 0.9.13
2022-09-08T06:44:49.7294349Z Author : GitTools Contributors
2022-09-08T06:44:49.7294670Z Help : See the documentation for help
2022-09-08T06:44:49.7295041Z ==============================================================================
2022-09-08T06:44:50.0254563Z Command: dotnet-gitversion D:/a/1/s /output json /output buildserver
2022-09-08T06:44:50.0258797Z [command]C:\hostedtoolcache\windows\GitVersion.Tool\5.10.3\x64\dotnet-gitversion.exe D:/a/1/s /output json /output buildserver
2022-09-08T06:44:51.1675968Z INFO [09/08/22 6:44:50:47] Working directory: D:/a/1/s
2022-09-08T06:44:51.1677354Z INFO [09/08/22 6:44:50:68] Project root is: D:\a\1\s
2022-09-08T06:44:51.1678019Z INFO [09/08/22 6:44:50:68] DotGit directory is: D:\a\1\s.git
2022-09-08T06:44:51.1678708Z INFO [09/08/22 6:44:50:68] Branch from build environment: refs/heads/gitversion-error
2022-09-08T06:44:51.1679501Z INFO [09/08/22 6:44:50:68] Begin: Normalizing git directory for branch 'refs/heads/gitversion-error'
2022-09-08T06:44:51.1680585Z INFO [09/08/22 6:44:50:72] One remote found (origin -> 'https://%%%%%%@dev.azure.com/%%%%%%/%%%%%%/_git/%%%%%%').
2022-09-08T06:44:51.1682047Z INFO [09/08/22 6:44:50:72] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
2022-09-08T06:44:51.1685460Z INFO [09/08/22 6:44:50:73] Creating local branch gitversion-error
2022-09-08T06:44:51.1686456Z INFO [09/08/22 6:44:50:77] Creating local branch from remote tracking 'refs/remotes/origin/42fed851e0050dc5227d461cb2fcf1086db89f5b'.
2022-09-08T06:44:51.1687579Z INFO [09/08/22 6:44:50:79] HEAD points at branch 'refs/heads/gitversion-error'.
2022-09-08T06:44:51.1690827Z INFO [09/08/22 6:44:50:79] End: Normalizing git directory for branch 'refs/heads/gitversion-error' (Took: 105.96ms)
2022-09-08T06:44:51.1693956Z INFO [09/08/22 6:44:50:80] Begin: Loading version variables from disk cache
2022-09-08T06:44:51.1695001Z INFO [09/08/22 6:44:50:80] Cache file D:\a\1\s.git\gitversion_cache\46DC55E6B2D286B169686372F5F37D58E41CDEB9.yml not found.
2022-09-08T06:44:51.1697428Z INFO [09/08/22 6:44:50:80] End: Loading version variables from disk cache (Took: 0.51ms)
2022-09-08T06:44:51.1698964Z INFO [09/08/22 6:44:50:80] Using latest commit on specified branch
2022-09-08T06:44:51.1699763Z INFO [09/08/22 6:44:50:96] No branch configuration found for branch gitversion-error, falling back to default configuration
2022-09-08T06:44:51.1702065Z INFO [09/08/22 6:44:50:97] Begin: Attempting to inherit branch configuration from parent branch
2022-09-08T06:44:51.1703849Z INFO [09/08/22 6:44:50:97] End: Attempting to inherit branch configuration from parent branch (Took: 8.03ms)
2022-09-08T06:44:51.1705950Z INFO [09/08/22 6:44:51:06] Attempting to show the current git graph (please include in issue):
2022-09-08T06:44:51.1707540Z ERROR [09/08/22 6:44:51:06] An unexpected error occurred:
2022-09-08T06:44:51.1708297Z System.NullReferenceException: Object reference not set to an instance of an object.
2022-09-08T06:44:51.1711622Z at LibGit2Sharp.Core.Handles.ObjectHandle.op_Implicit(ObjectHandle handle) in //LibGit2Sharp/Core/Handles/Objects.cs:line 509
2022-09-08T06:44:51.1713897Z at LibGit2Sharp.Core.Proxy.git_commit_author(ObjectHandle obj) in //LibGit2Sharp/Core/Proxy.cs:line 289
2022-09-08T06:44:51.1715716Z at LibGit2Sharp.Core.LazyGroup1.Dependent
2.LibGit2Sharp.Core.LazyGroup<T>.IEvaluator<TInput>.Evaluate(TInput input) in //LibGit2Sharp/Core/LazyGroup.cs:line 88
2022-09-08T06:44:51.1721649Z at LibGit2Sharp.Core.LazyGroup1.<Evaluate>b__6_0(T input) in /_/LibGit2Sharp/Core/LazyGroup.cs:line 36 2022-09-08T06:44:51.1724384Z at LibGit2Sharp.Core.GitObjectLazyGroup.EvaluateInternal(Action
1 evaluator) in //LibGit2Sharp/Core/GitObjectLazyGroup.cs:line 20
2022-09-08T06:44:51.1726824Z at LibGit2Sharp.Core.LazyGroup1.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 34 2022-09-08T06:44:51.1727737Z at LibGit2Sharp.Core.LazyGroup
1.Dependent2.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 80 2022-09-08T06:44:51.1729606Z at LibGit2Sharp.Core.LazyGroup
1.Dependent2.get_Value() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 73 2022-09-08T06:44:51.1730465Z at LibGit2Sharp.Commit.get_Committer() in /_/LibGit2Sharp/Commit.cs:line 87 2022-09-08T06:44:51.1731416Z at GitVersion.Commit..ctor(Commit innerCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 17 2022-09-08T06:44:51.1732513Z at GitVersion.Commit.<>c.<.ctor>b__3_0(Commit parent) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 16 2022-09-08T06:44:51.1733450Z at System.Linq.Enumerable.SelectEnumerableIterator
2.MoveNext()
2022-09-08T06:44:51.1734025Z at System.Linq.Enumerable.Count[TSource](IEnumerable1 source) 2022-09-08T06:44:51.1735739Z at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Int32 recursions, IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList
1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 77
2022-09-08T06:44:51.1737739Z at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfigurationInternal(Int32 recursions, IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 54 2022-09-08T06:44:51.1739085Z 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 28
2022-09-08T06:44:51.1740095Z at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 39
2022-09-08T06:44:51.1740942Z at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs:line 37
2022-09-08T06:44:51.1741554Z at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) 2022-09-08T06:44:51.1742294Z at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
2022-09-08T06:44:51.1743012Z at System.Lazy1.CreateValue() 2022-09-08T06:44:51.1743812Z at System.Lazy
1.get_Value()
2022-09-08T06:44:51.1744725Z at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 15
2022-09-08T06:44:51.1746011Z at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 30
2022-09-08T06:44:51.1747580Z at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 52
2022-09-08T06:44:51.1748945Z at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 66
2022-09-08T06:44:51.1749961Z INFO [09/08/22 6:44:51:06] Showing max of 100 commits
2022-09-08T06:44:51.1751080Z INFO [09/08/22 6:44:51:13] * 42fed85 18 hours ago (grafted, HEAD -> gitversion-error, origin/42fed851e0050dc5227d461cb2fcf1086db89f5b, 42fed851e0050dc5227d461cb2fcf1086db89f5b)
2022-09-08T06:44:51.1752252Z
2022-09-08T06:44:51.1752578Z INFO [09/08/22 6:44:50:39] Applicable build agent found: 'AzurePipelines'.
2022-09-08T06:44:51.1752946Z INFO [09/08/22 6:44:50:47] Working directory: D:/a/1/s
2022-09-08T06:44:51.1753289Z INFO [09/08/22 6:44:50:68] Project root is: D:\a\1\s
2022-09-08T06:44:51.1753627Z INFO [09/08/22 6:44:50:68] DotGit directory is: D:\a\1\s.git
2022-09-08T06:44:51.1754871Z INFO [09/08/22 6:44:50:68] Branch from build environment: refs/heads/gitversion-error
2022-09-08T06:44:51.1755361Z INFO [09/08/22 6:44:50:68] Begin: Normalizing git directory for branch 'refs/heads/gitversion-error'
2022-09-08T06:44:51.1756001Z INFO [09/08/22 6:44:50:72] One remote found (origin -> 'https://%%%%%%@dev.azure.com/%%%%%%/%%%%%%/git/%%%%%%').
2022-09-08T06:44:51.1756750Z INFO [09/08/22 6:44:50:72] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
2022-09-08T06:44:51.1757291Z INFO [09/08/22 6:44:50:73] Creating local branch gitversion-error
2022-09-08T06:44:51.1757796Z INFO [09/08/22 6:44:50:77] Creating local branch from remote tracking 'refs/remotes/origin/42fed851e0050dc5227d461cb2fcf1086db89f5b'.
2022-09-08T06:44:51.1758303Z INFO [09/08/22 6:44:50:79] HEAD points at branch 'refs/heads/gitversion-error'.
2022-09-08T06:44:51.1758802Z INFO [09/08/22 6:44:50:79] End: Normalizing git directory for branch 'refs/heads/gitversion-error' (Took: 105.96ms)
2022-09-08T06:44:51.1759271Z INFO [09/08/22 6:44:50:80] Begin: Loading version variables from disk cache
2022-09-08T06:44:51.1759775Z INFO [09/08/22 6:44:50:80] Cache file D:\a\1\s.git\gitversion_cache\46DC55E6B2D286B169686372F5F37D58E41CDEB9.yml not found.
2022-09-08T06:44:51.1760284Z INFO [09/08/22 6:44:50:80] End: Loading version variables from disk cache (Took: 0.51ms)
2022-09-08T06:44:51.1760925Z INFO [09/08/22 6:44:50:80] Using latest commit on specified branch
2022-09-08T06:44:51.1761392Z INFO [09/08/22 6:44:50:96] No branch configuration found for branch gitversion-error, falling back to default configuration
2022-09-08T06:44:51.1761915Z INFO [09/08/22 6:44:50:97] Begin: Attempting to inherit branch configuration from parent branch
2022-09-08T06:44:51.1762405Z INFO [09/08/22 6:44:50:97] End: Attempting to inherit branch configuration from parent branch (Took: 8.03ms)
2022-09-08T06:44:51.1762851Z ERROR [09/08/22 6:44:51:06] An unexpected error occurred:
2022-09-08T06:44:51.1763239Z System.NullReferenceException: Object reference not set to an instance of an object.
2022-09-08T06:44:51.1763750Z at LibGit2Sharp.Core.Handles.ObjectHandle.op_Implicit(ObjectHandle handle) in //LibGit2Sharp/Core/Handles/Objects.cs:line 509
2022-09-08T06:44:51.1764318Z at LibGit2Sharp.Core.Proxy.git_commit_author(ObjectHandle obj) in //LibGit2Sharp/Core/Proxy.cs:line 289
2022-09-08T06:44:51.1764942Z at LibGit2Sharp.Core.LazyGroup1.Dependent
2.LibGit2Sharp.Core.LazyGroup<T>.IEvaluator<TInput>.Evaluate(TInput input) in //LibGit2Sharp/Core/LazyGroup.cs:line 88
2022-09-08T06:44:51.1765566Z at LibGit2Sharp.Core.LazyGroup1.<Evaluate>b__6_0(T input) in /_/LibGit2Sharp/Core/LazyGroup.cs:line 36 2022-09-08T06:44:51.1766213Z at LibGit2Sharp.Core.GitObjectLazyGroup.EvaluateInternal(Action
1 evaluator) in /_/LibGit2Sharp/Core/GitObjectLazyGroup.cs:line 20
2022-09-08T06:44:51.1767342Z at LibGit2Sharp.Core.LazyGroup1.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 34 2022-09-08T06:44:51.1767829Z at LibGit2Sharp.Core.LazyGroup
1.Dependent2.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 80 2022-09-08T06:44:51.1768346Z at LibGit2Sharp.Core.LazyGroup
1.Dependent2.get_Value() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 73 2022-09-08T06:44:51.1768806Z at LibGit2Sharp.Commit.get_Committer() in /_/LibGit2Sharp/Commit.cs:line 87 2022-09-08T06:44:51.1769425Z at GitVersion.Commit..ctor(Commit innerCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 17 2022-09-08T06:44:51.1770064Z at GitVersion.Commit.<>c.<.ctor>b__3_0(Commit parent) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 16 2022-09-08T06:44:51.1770585Z at System.Linq.Enumerable.SelectEnumerableIterator
2.MoveNext()
2022-09-08T06:44:51.1770959Z at System.Linq.Enumerable.Count[TSource](IEnumerable1 source) 2022-09-08T06:44:51.1771841Z at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Int32 recursions, IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList
1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 77
2022-09-08T06:44:51.1773951Z at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfigurationInternal(Int32 recursions, IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 54 2022-09-08T06:44:51.1775251Z 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 28
2022-09-08T06:44:51.1776256Z at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 39
2022-09-08T06:44:51.1777641Z at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs:line 37
2022-09-08T06:44:51.1778318Z at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) 2022-09-08T06:44:51.1778873Z at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
2022-09-08T06:44:51.1779322Z at System.Lazy1.CreateValue() 2022-09-08T06:44:51.1779627Z at System.Lazy
1.get_Value()
2022-09-08T06:44:51.1780236Z at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 15
2022-09-08T06:44:51.1781181Z at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 30
2022-09-08T06:44:51.1782068Z at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 52
2022-09-08T06:44:51.1782949Z at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 66
2022-09-08T06:44:51.1783865Z INFO [09/08/22 6:44:51:06] Attempting to show the current git graph (please include in issue):
2022-09-08T06:44:51.1784606Z INFO [09/08/22 6:44:51:06] Showing max of 100 commits
2022-09-08T06:44:51.1785653Z INFO [09/08/22 6:44:51:13] * 42fed85 18 hours ago (grafted, HEAD -> gitversion-error, origin/42fed851e0050dc5227d461cb2fcf1086db89f5b, 42fed851e0050dc5227d461cb2fcf1086db89f5b)
2022-09-08T06:44:51.1786575Z
2022-09-08T06:44:51.1787011Z INFO [09/08/22 6:44:51:15] Done writing
2022-09-08T06:44:51.1830848Z ##[error]SyntaxError: Unexpected end of JSON input
2022-09-08T06:44:51.1848415Z ##[section]Finishing: Execute GitVersion
We are getting exactly the same with new pipelines, existing pipelines continue to work
We are getting exactly the same with new pipelines, existing pipelines continue to work
Yes, it is very odd. I raised a ticket with MS, they pointed me here. But this task has not changed (at least in version number!), so I am not convinced it is not something that MS have tweaked that has made GitVersion unhappy. But so far I am not closer to getting a resolution, and we have had to stop using GitVersion for now.
@RichardMays It appears to be an Azure DevOps change, new pipelines are now defaulting to Shallow Fetch = 1 on Github checkouts, if you disable shallow fetch this should unblock you
If you still have your ticket open with Microsoft it might be worth letting them know
@RichardMays It appears to be an Azure DevOps change, new pipelines are now defaulting to Shallow Fetch = 1 on Github checkouts, if you disable shallow fetch this should unblock you
If you still have your ticket open with Microsoft it might be worth letting them know
Awesome, that is it. Thanks for the info, I have now got it to work. I shall drop MS an email back.
Thanks again :)
As discussed in https://github.com/GitTools/GitVersion/issues/2690 and https://github.com/GitTools/GitVersion/issues/3081, these problems are still occurring and I believe the core issue is that the AzDO task and GitHub Action does not properly deal with GitVersion itself crashing and instead always expecting valid JSON to be output to stdout
.
When GitVersion crashes for various reasons (increasingly due to AzDO maybe having changed the default to shallow fetching as discussed in https://github.com/GitTools/GitVersion/issues/3188#issuecomment-1241969803 and resolved in https://github.com/GitTools/GitVersion/issues/3091#issuecomment-1240999129), the AzDO task and GitHub Action does not seem to gracefully handle it. We need to remedy that, somehow.
Same behaviour here. A pipeline which hasn't run for 2 months suddenly is broken. I tried with different fetchDepth
settings (0, 1, 100).
- checkout: self
persistCredentials: true
fetchDepth: 100
- task: UseDotNet@2
displayName: 'Use dotnet 6.x'
inputs:
version: 6.x
- task: UseDotNet@2
displayName: 'Use dotnet 7.x'
inputs:
version: 7.x
- task: gitversion/setup@0
displayName: 'Install GitVersion'
inputs:
versionSpec: '5.5.0'
- task: gitversion/execute@0
displayName: 'Determine Version'
The output:
Starting: Determine Version
==============================================================================
Task : Execute GitVersion Task
Description : Easy Semantic Versioning (http://semver.org/) for projects using Git
Version : 0.9.15
Author : GitTools Contributors
Help : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Command: dotnet-gitversion /home/vsts/work/1/s /output json /output buildserver
/opt/hostedtoolcache/GitVersion.Tool/5.5.0/x64/dotnet-gitversion /home/vsts/work/1/s /output json /output buildserver
You must install or update .NET to run this application.
App: /opt/hostedtoolcache/GitVersion.Tool/5.5.0/x64/dotnet-gitversion
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
.NET location: /opt/hostedtoolcache/dotnet
The following frameworks were found:
6.0.11 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
7.0.0 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.22.04-x64
##[error]SyntaxError: Unexpected end of JSON input
Finishing: Determine Version
Based on the default behaviour of git checkout on Azure DevOps, I tried setting fetchTags: true
.
The tags are effectively fetched, but GitVersion still fails in the same way.
@jochenz as you can see from the error - it's trying to run on .net core 3.1, and that is because the version of gitversion that you install is 5.5.0. Now if you change the versionSpec to the latest version that currently is 5.11.1, it should work, as this one depends on .net 6.0.
The reason it's failing is the new AzureDevops/GitHub Actions images do not pre-install the .net core 3.1.
If you are running this inside Azure Devops, make sure that you have set the Pipeline to not shallow Fetch .
Edit Pipeline -> Elipsis(top right) -> Triggers -> YAML -> Get Sources
This took me quite some time to figure out.
(found it as answer to another problem here https://github.com/GitTools/GitVersion/issues/3091 thanks to @PaulFarry )