This might be related to #1876. But I'm not sure, so I created a new issue.
When building with a VSBuild step inside Azure Devops pipelines, the build fails with this error:
GitVersionTask.targets(10,9): Error : Value cannot be null.
Parameter name: source
Log from Azure Devops pipeline.txt
As with #1876, downgrading to 5.0.1 is a workaround.
@pannikbutton can you check the 5.1.2-beta.1+8 version if it fixes the issue?
@arturcic I have tried GitVersionTask 5.1.2-beta1.8. However, the same error occurs.
Log from Azure Devops using GitVersionTask 5.1.2-beta1.8.txt
I also tried the 5.1.2-beta.1+8
And I experienced this error on Jenkins
00:03:39 Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
00:03:39 Copyright (C) Microsoft Corporation. All rights reserved.
00:03:39
00:03:39 C:\Users\ContainerAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.8\build\GitVersionTask.targets(10,9): error : Object reference not set to an instance of an object. [C:\jenkins\workspace\Project_bump_GitVersionTask\Project\Project.csproj]
00:03:39 C:\Users\ContainerAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.8\build\GitVersionTask.targets(10,9): error : Object reference not set to an instance of an object. [C:\jenkins\workspace\Project_bump_GitVersionTask\Project\Project.csproj]
00:03:39 C:\Users\ContainerAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.8\build\GitVersionTask.targets(10,9): error : Object reference not set to an instance of an object. [C:\jenkins\workspace\Project_bump_GitVersionTask\Project\Project.csproj]
00:03:40 C:\Users\ContainerAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.8\build\GitVersionTask.targets(10,9): error : Object reference not set to an instance of an object. [C:\jenkins\workspace\Project_bump_GitVersionTask\Project\Project.csproj]
FYI using 5.1.2-beta1.8 of GitVersion.Tool passes but GitVersionTask fails.
@casz, @pannikbutton can any of you create a repo that reproduces this error? or if it's a public repo I can have a look?
I think any csproj will do as long as the checkout is done by Jenkins git plugin or Azure DevOps
I do have a basic GitVersion repo I could share and also confirm that is the case.
We do have artifacts testing as part of the build pipeline, and we test the msbuild task inside of a container, by running dotnet build, and the pipeline runs on Azure Pipelines, so can it be related to Jenkins?
and this is the test project https://github.com/GitTools/GitVersion/tree/master/test, that we use when running in pipeline
I do have a basic GitVersion repo I could share and also confirm that is the case.
Please share it and add steps to reproduce
Here is the repo
https://github.com/casz/gitversionRepo
Pipeline execution
07:31:55 Push event to branch test/GitVersionTask
07:31:55 Started by GitLab push by Joseph Petersen
07:31:56 Querying the current revision of branch test/GitVersionTask...
07:31:56 Current revision of branch test/GitVersionTask is 399987b9ed9e62e289103a140e4c3fc2f3d83242
07:31:56 Obtained Jenkinsfile from 399987b9ed9e62e289103a140e4c3fc2f3d83242
07:31:56 Running in Durability level: MAX_SURVIVABILITY
07:31:56 Loading library ThreeShape@shared-pipeline
07:31:56 Attempting to resolve shared-pipeline from remote references...
07:31:56 > git --version # timeout=10
07:31:56 using GIT_SSH to set credentials SSH key for GitLab
07:31:56 > git ls-remote -- [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git # timeout=10
07:31:57 Found match: refs/heads/shared-pipeline revision 06c46f3e6dcf4d7b7d1b2833cea000a7cfe325de
07:31:57 using credential gitlab_ssh_key
07:31:57 Cloning the remote Git repository
07:31:57 Cloning with configured refspecs honoured and without tags
07:31:57 Cloning repository [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git
07:31:57 > git init /var/jenkins_home/jobs/NuGet/jobs/testing/branches/test-GitVersionTask.67495s/workspace@libs/ThreeShape@2 # timeout=10
07:31:57 Fetching upstream changes from [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git
07:31:57 > git --version # timeout=10
07:31:57 using GIT_SSH to set credentials SSH key for GitLab
07:31:57 > git fetch --no-tags --force --progress -- [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git +refs/heads/*:refs/remotes/origin/* # timeout=10
07:31:57 > git config remote.origin.url [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git # timeout=10
07:31:57 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
07:31:57 > git config remote.origin.url [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git # timeout=10
07:31:57 Fetching without tags
07:31:57 Fetching upstream changes from [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git
07:31:57 using GIT_SSH to set credentials SSH key for GitLab
07:31:58 > git fetch --no-tags --force --progress -- [email protected]:Jenkins/Configurations/jenkins-pipeline-library.git +refs/heads/*:refs/remotes/origin/* # timeout=10
07:31:58 Checking out Revision 06c46f3e6dcf4d7b7d1b2833cea000a7cfe325de (shared-pipeline)
07:31:58 > git config core.sparsecheckout # timeout=10
07:31:58 > git checkout -f 06c46f3e6dcf4d7b7d1b2833cea000a7cfe325de # timeout=10
07:31:58 > git --version # timeout=10
07:31:58 [GitLab Pipeline Status] Notifying branch build status: RUNNING NuGet/testing/test%2FGitVersionTask: Build started...
07:31:58 [Pipeline] Start of Pipeline
07:31:59 [Pipeline] echo
07:31:59 --- RUNNING SHARED LIBRARY STEP: buildNugetPackage ---
07:31:59 [Pipeline] node
07:32:14 Still waiting to schedule task
07:32:14 βwindows_docker-production-1β is offline
07:33:49 Running on windows_docker-production-1 in C:/jenkins/workspace/NuGet_testing_test_GitVersionTask
07:33:49 [Pipeline] {
07:33:49 [Pipeline] stage
07:33:49 [Pipeline] { (Declarative: Checkout SCM)
07:33:49 [Pipeline] checkout
07:33:53 using credential gitlab_ssh_key
07:33:53 Cloning the remote Git repository
07:33:53 Cloning repository [email protected]:NuGet/testing.git
07:33:53 > git init C:\jenkins\workspace\NuGet_testing_test_GitVersionTask # timeout=10
07:33:53 Fetching upstream changes from [email protected]:NuGet/testing.git
07:33:53 > git --version # timeout=10
07:33:54 using GIT_SSH to set credentials SSH key for GitLab
07:33:54 > git fetch --tags --force --progress -- [email protected]:NuGet/testing.git +refs/heads/*:refs/remotes/origin/* # timeout=10
07:33:56 > git config remote.origin.url [email protected]:NuGet/testing.git # timeout=10
07:33:56 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
07:33:56 > git config remote.origin.url [email protected]:NuGet/testing.git # timeout=10
07:33:56 Fetching upstream changes from [email protected]:NuGet/testing.git
07:33:56 using GIT_SSH to set credentials SSH key for GitLab
07:33:56 > git fetch --tags --force --progress -- [email protected]:NuGet/testing.git +refs/heads/test/GitVersionTask:refs/remotes/origin/test/GitVersionTask # timeout=10
07:33:57 Checking out Revision 399987b9ed9e62e289103a140e4c3fc2f3d83242 (test/GitVersionTask)
07:33:57 Enabling Git LFS pull
07:33:57 > git config core.sparsecheckout # timeout=10
07:33:57 > git checkout -f 399987b9ed9e62e289103a140e4c3fc2f3d83242 # timeout=10
07:33:58 > git config --get remote.origin.url # timeout=10
07:33:58 using GIT_SSH to set credentials SSH key for GitLab
07:33:58 > git lfs pull origin # timeout=10
07:34:02 Commit message: "Update Jenkinsfile, Project1/testing.csproj files"
07:34:02 First time build. Skipping changelog.
07:34:02 > git --version # timeout=10
07:34:02 fatal: bad object 06c46f3e6dcf4d7b7d1b2833cea000a7cfe325de
07:34:02 [GitLab Pipeline Status] Notifying branch build status: RUNNING NuGet/testing/test%2FGitVersionTask: Build started...
07:34:02 [Pipeline] }
07:34:02 [Pipeline] // stage
07:34:02 [Pipeline] withEnv
07:34:02 [Pipeline] {
07:34:03 [Pipeline] withEnv
07:34:03 [Pipeline] {
07:34:03 [Pipeline] withDockerRegistry
07:34:03 $ docker login -u tcagentuser -p ******** https://artifactorydk.company.com/threeshapedocker/
07:34:03 WARNING! Using --password via the CLI is insecure. Use --password-stdin.
07:34:03 WARNING! Your password will be stored unencrypted in C:\jenkins\workspace\NuGet_testing_test_GitVersionTask@tmp\9deec96d-f0f5-4c32-a06e-debfba272ce5\config.json.
07:34:03 Configure a credential helper to remove this warning. See
07:34:03 https://docs.docker.com/engine/reference/commandline/login/#credentials-store
07:34:03
07:34:03 Login Succeeded
07:34:03 [Pipeline] {
07:34:03 [Pipeline] isUnix
07:34:03 [Pipeline] bat
07:34:04
07:34:04 C:\jenkins\workspace\NuGet_testing_test_GitVersionTask>docker inspect -f . artifactorydk.company.com/threeshapedocker/threeshape.msbuild:ltsc2019
07:34:04 .
07:34:04 [Pipeline] withDockerContainer
07:34:05 windows_docker-production-1 seems to be running inside container dd1e590a880486afa059eae62e0039033fa9493fffc0006ab7d36ad3eba4648c
07:34:05 $ docker run -d -t --entrypoint powershell -w C:/jenkins/workspace/NuGet_testing_test_GitVersionTask/ --volumes-from dd1e590a880486afa059eae62e0039033fa9493fffc0006ab7d36ad3eba4648c -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** artifactorydk.company.com/threeshapedocker/threeshape.msbuild:ltsc2019 cmd.exe
07:34:07 $ docker top 8561441a43df25bf00412315c6febd235f217bb25fe5c67c778662354e6544de
07:34:08 ERROR: The container started but didn't run the expected command. Please double check your ENTRYPOINT does execute the command passed as docker run argument, as required by official docker images (see https://github.com/docker-library/official-images#consistency for entrypoint consistency requirements).
07:34:08 Alternatively you can force image entrypoint to be disabled by adding option `--entrypoint=''`.
07:34:09 [Pipeline] {
07:34:09 [Pipeline] withCredentials
07:34:10 Masking supported pattern matches of %ARTIFACTORY_CRED% or %ARTIFACTORY_CRED_USR% or %ARTIFACTORY_CRED_PSW% or %ThreeShapeCloud%
07:34:10 [Pipeline] {
07:34:10 [Pipeline] stage
07:34:10 [Pipeline] { (Nuget restore)
07:34:10 [Pipeline] powershell
07:34:11 [Pipeline] powershell
07:34:14 Restoring packages for C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\Project1\testing.csproj...
07:34:16 Installing GitVersionTask 5.1.2-beta1.8.
07:34:16 Generating MSBuild file C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\Project1\obj\testing.csproj.nuget.g.props.
07:34:16 Generating MSBuild file C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\Project1\obj\testing.csproj.nuget.g.targets.
07:34:16 Restore completed in 2.28 sec for C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\Project1\testing.csproj.
07:34:16 [Pipeline] }
07:34:16 [Pipeline] // stage
07:34:16 [Pipeline] stage
07:34:16 [Pipeline] { (Build solution)
07:34:17 [Pipeline] echo
07:34:17 --- RUNNING SHARED LIBRARY STEP: dotnetTool ---
07:34:17 [Pipeline] echo
07:34:17 Installing GitVersion.Tool, v5.0.1 from https://api.nuget.org/v3/index.json.
07:34:17 [Pipeline] powershell
07:34:20 You can invoke the tool using the following command: dotnet-gitversion
07:34:20 Tool 'gitversion.tool' (version '5.0.1') was successfully installed.
07:34:20 [Pipeline] powershell
07:34:21 INFO [11/06/19 7:34:21:53] Dumping commit graph:
07:34:21 INFO [11/06/19 7:34:21:62] * 399987b 3 minutes ago (HEAD, origin/test/GitVersionTask)
07:34:21 * a9de822 5 days ago (origin/master)
07:34:21 * 5791e09 5 days ago
07:34:21 * e8ad3e4 5 days ago
07:34:21 * b55cde7 5 days ago
07:34:21 * 5ff7817 5 days ago
07:34:21 * 28be6c7 5 days ago
07:34:21 * 4b8e400 5 days ago
07:34:21 * 83c9a30 5 days ago
07:34:21 * 3cfe9f7 5 days ago
07:34:21 * 89eb96e 5 days ago
07:34:21 * 61b16e1 5 days ago
07:34:21 * b8003cb 5 days ago
07:34:21 * 1e4a131 5 days ago
07:34:21 * 40dda40 5 days ago
07:34:21
07:34:21 INFO [11/06/19 7:34:21:62] Working directory: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask
07:34:21 INFO [11/06/19 7:34:21:62] IsDynamicGitRepository: False
07:34:21 INFO [11/06/19 7:34:21:65] Returning Project Root from DotGitDirectory: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\.git - C:\jenkins\workspace\NuGet_testing_test_GitVersionTask
07:34:21 INFO [11/06/19 7:34:21:65] Running on Windows.
07:34:21 INFO [11/06/19 7:34:21:66] Applicable build agent found: 'Jenkins'.
07:34:21 INFO [11/06/19 7:34:21:66] Branch from build environment: test/GitVersionTask
07:34:21 INFO [11/06/19 7:34:21:66] Begin: Normalizing git directory for branch 'test/GitVersionTask'
07:34:21 INFO [11/06/19 7:34:21:71] One remote found (origin -> '[email protected]:NuGet/testing.git').
07:34:21 INFO [11/06/19 7:34:21:71] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
07:34:21 INFO [11/06/19 7:34:21:72] Creating local branch refs/heads/test/GitVersionTask pointing at 399987b9ed9e62e289103a140e4c3fc2f3d83242
07:34:21 INFO [11/06/19 7:34:21:76] Creating local branch from remote tracking 'refs/remotes/origin/master'.
07:34:21 INFO [11/06/19 7:34:21:78] HEAD points at branch 'refs/heads/test/GitVersionTask'.
07:34:21 INFO [11/06/19 7:34:21:78] End: Normalizing git directory for branch 'test/GitVersionTask' (Took: 124.78ms)
07:34:21 INFO [11/06/19 7:34:21:78] IsDynamicGitRepository: False
07:34:21 INFO [11/06/19 7:34:21:79] Returning Project Root from DotGitDirectory: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\.git - C:\jenkins\workspace\NuGet_testing_test_GitVersionTask
07:34:21 INFO [11/06/19 7:34:21:79] Project root is: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask
07:34:21 INFO [11/06/19 7:34:21:79] DotGit directory is: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\.git
07:34:21 INFO [11/06/19 7:34:21:80] IsDynamicGitRepository: False
07:34:21 INFO [11/06/19 7:34:21:80] Returning Project Root from DotGitDirectory: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\.git - C:\jenkins\workspace\NuGet_testing_test_GitVersionTask
07:34:21 INFO [11/06/19 7:34:21:80] IsDynamicGitRepository: False
07:34:21 INFO [11/06/19 7:34:21:80] Returning Project Root from DotGitDirectory: C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\.git - C:\jenkins\workspace\NuGet_testing_test_GitVersionTask
07:34:22 INFO [11/06/19 7:34:21:95] Using latest commit on specified branch
07:34:22 INFO [11/06/19 7:34:21:97] No branch configuration found for branch test/GitVersionTask, falling back to default configuration
07:34:22 INFO [11/06/19 7:34:21:97] Begin: Attempting to inherit branch configuration from parent branch
07:34:22 INFO [11/06/19 7:34:21:98] Begin: Finding branch source of 'test/GitVersionTask'
07:34:22 INFO [11/06/19 7:34:21:99] Begin: Finding merge base between 'test/GitVersionTask' and 'master'.
07:34:22 INFO [11/06/19 7:34:22:00] Found merge base of a9de822c3d530d8e70f3caac93bd6629e0c02754
07:34:22 INFO [11/06/19 7:34:22:01] Merge base of test/GitVersionTask' and 'master is a9de822c3d530d8e70f3caac93bd6629e0c02754
07:34:22 INFO [11/06/19 7:34:22:01] End: Finding merge base between 'test/GitVersionTask' and 'master'. (Took: 17.20ms)
07:34:22 INFO [11/06/19 7:34:22:01] Begin: Finding merge base between 'test/GitVersionTask' and 'origin/master'.
07:34:22 INFO [11/06/19 7:34:22:01] Found merge base of a9de822c3d530d8e70f3caac93bd6629e0c02754
07:34:22 INFO [11/06/19 7:34:22:01] Merge base of test/GitVersionTask' and 'origin/master is a9de822c3d530d8e70f3caac93bd6629e0c02754
07:34:22 INFO [11/06/19 7:34:22:01] End: Finding merge base between 'test/GitVersionTask' and 'origin/master'. (Took: 0.85ms)
07:34:22 INFO [11/06/19 7:34:22:02] Multiple source branches have been found, picking the first one (master).
07:34:22 This may result in incorrect commit counting.
07:34:22 Options were:
07:34:22 master, origin/master
07:34:22 INFO [11/06/19 7:34:22:02] End: Finding branch source of 'test/GitVersionTask' (Took: 42.60ms)
07:34:22 INFO [11/06/19 7:34:22:02] Begin: Getting branches containing the commit 'a9de822c3d530d8e70f3caac93bd6629e0c02754'.
07:34:22 INFO [11/06/19 7:34:22:02] Trying to find direct branches.
07:34:22 INFO [11/06/19 7:34:22:03] Direct branch found: 'master'.
07:34:22 INFO [11/06/19 7:34:22:03] End: Getting branches containing the commit 'a9de822c3d530d8e70f3caac93bd6629e0c02754'. (Took: 2.02ms)
07:34:22 INFO [11/06/19 7:34:22:03] Found possible parent branches: master
07:34:22 INFO [11/06/19 7:34:22:03] End: Attempting to inherit branch configuration from parent branch (Took: 57.26ms)
07:34:22 INFO [11/06/19 7:34:22:03] Running against branch: test/GitVersionTask (399987b9ed9e62e289103a140e4c3fc2f3d83242)
07:34:22 INFO [11/06/19 7:34:22:04] Begin: Calculating base versions
07:34:22 INFO [11/06/19 7:34:22:05] Fallback base version: 0.1.0 with commit count source 40dda40b82a2b7563c9c8c3eedd157a5e56bf5b0 (Incremented: None)
07:34:22 INFO [11/06/19 7:34:22:10] Found multiple base versions which will produce the same SemVer (0.1.0), taking oldest source for commit counting (Fallback base version)
07:34:22 INFO [11/06/19 7:34:22:10] Base version used: Fallback base version: 0.1.0 with commit count source 40dda40b82a2b7563c9c8c3eedd157a5e56bf5b0 (Incremented: None)
07:34:22 INFO [11/06/19 7:34:22:10] End: Calculating base versions (Took: 63.03ms)
07:34:22 INFO [11/06/19 7:34:22:11] Skipping version increment
07:34:22 INFO [11/06/19 7:34:22:11] 14 commits found between 40dda40b82a2b7563c9c8c3eedd157a5e56bf5b0 and 399987b9ed9e62e289103a140e4c3fc2f3d83242
07:34:22 INFO [11/06/19 7:34:22:11] Using branch name to calculate version tag
07:34:22 INFO [11/06/19 7:34:22:12] Begin: Getting version tags from branch 'refs/heads/test/GitVersionTask'.
07:34:22 INFO [11/06/19 7:34:22:12] End: Getting version tags from branch 'refs/heads/test/GitVersionTask'. (Took: 6.29ms)
07:34:22 INFO [11/06/19 7:34:22:13] Applicable build agent found: 'Jenkins'.
07:34:22 Executing GenerateSetVersionMessage for 'Jenkins'.
07:34:22 0.1.0-test-GitVersionTask.1+14
07:34:22 Executing GenerateBuildLogOutput for 'Jenkins'.
07:34:22 GitVersion_Major=0
07:34:22 GitVersion_Minor=1
07:34:22 GitVersion_Patch=0
07:34:22 GitVersion_PreReleaseTag=test-GitVersionTask.1
07:34:22 GitVersion_PreReleaseTagWithDash=-test-GitVersionTask.1
07:34:22 GitVersion_PreReleaseLabel=test-GitVersionTask
07:34:22 GitVersion_PreReleaseNumber=1
07:34:22 GitVersion_WeightedPreReleaseNumber=1
07:34:22 GitVersion_BuildMetaData=14
07:34:22 GitVersion_BuildMetaDataPadded=0014
07:34:22 GitVersion_FullBuildMetaData=14.Branch.test-GitVersionTask.Sha.399987b9ed9e62e289103a140e4c3fc2f3d83242
07:34:22 GitVersion_MajorMinorPatch=0.1.0
07:34:22 GitVersion_SemVer=0.1.0-test-GitVersionTask.1
07:34:22 GitVersion_LegacySemVer=0.1.0-test-GitVersionTask1
07:34:22 GitVersion_LegacySemVerPadded=0.1.0-test-GitVersionT0001
07:34:22 GitVersion_AssemblySemVer=0.1.0.0
07:34:22 GitVersion_AssemblySemFileVer=0.1.0.0
07:34:22 GitVersion_FullSemVer=0.1.0-test-GitVersionTask.1+14
07:34:22 GitVersion_InformationalVersion=0.1.0-test-GitVersionTask.1+14.Branch.test-GitVersionTask.Sha.399987b9ed9e62e289103a140e4c3fc2f3d83242
07:34:22 GitVersion_BranchName=test/GitVersionTask
07:34:22 GitVersion_Sha=399987b9ed9e62e289103a140e4c3fc2f3d83242
07:34:22 GitVersion_ShortSha=399987b
07:34:22 GitVersion_NuGetVersionV2=0.1.0-test-gitversiont0001
07:34:22 GitVersion_NuGetVersion=0.1.0-test-gitversiont0001
07:34:22 GitVersion_NuGetPreReleaseTagV2=test-gitversiont0001
07:34:22 GitVersion_NuGetPreReleaseTag=test-gitversiont0001
07:34:22 GitVersion_VersionSourceSha=40dda40b82a2b7563c9c8c3eedd157a5e56bf5b0
07:34:22 GitVersion_CommitsSinceVersionSource=14
07:34:22 GitVersion_CommitsSinceVersionSourcePadded=0014
07:34:22 GitVersion_CommitDate=2019-11-06
07:34:22 Outputting variables to 'gitversion.properties' ...
07:34:22 [Pipeline] powershell
07:34:24 [Pipeline] powershell
07:34:25
07:34:25 Name Value
07:34:25 ---- -----
07:34:25 GitVersion_CommitsSinceVersionSource 14
07:34:25 GitVersion_NuGetVersionV2 0.1.0-test-gitversiont0001
07:34:25 GitVersion_NuGetPreReleaseTagV2 test-gitversiont0001
07:34:25 GitVersion_ShortSha 399987b
07:34:25 GitVersion_PreReleaseLabel test-GitVersionTask
07:34:25 GitVersion_BuildMetaDataPadded 0014
07:34:25 GitVersion_FullSemVer 0.1.0-test-GitVersionTask.1+14
07:34:25 GitVersion_CommitsSinceVersionSourcePadded 0014
07:34:25 GitVersion_WeightedPreReleaseNumber 1
07:34:25 GitVersion_AssemblySemFileVer 0.1.0.0
07:34:25 GitVersion_Sha 399987b9ed9e62e289103a140e4c3fc2f...
07:34:25 GitVersion_PreReleaseTag test-GitVersionTask.1
07:34:25 GitVersion_InformationalVersion 0.1.0-test-GitVersionTask.1+14.Br...
07:34:25 GitVersion_SemVer 0.1.0-test-GitVersionTask.1
07:34:25 GitVersion_NuGetVersion 0.1.0-test-gitversiont0001
07:34:25 GitVersion_Patch 0
07:34:25 GitVersion_BranchName test/GitVersionTask
07:34:25 GitVersion_PreReleaseTagWithDash -test-GitVersionTask.1
07:34:25 GitVersion_MajorMinorPatch 0.1.0
07:34:25 GitVersion_BuildMetaData 14
07:34:25 GitVersion_NuGetPreReleaseTag test-gitversiont0001
07:34:25 GitVersion_Major 0
07:34:25 GitVersion_LegacySemVer 0.1.0-test-GitVersionTask1
07:34:25 GitVersion_Minor 1
07:34:25 GitVersion_LegacySemVerPadded 0.1.0-test-GitVersionT0001
07:34:25 GitVersion_VersionSourceSha 40dda40b82a2b7563c9c8c3eedd157a5e...
07:34:25 GitVersion_FullBuildMetaData 14.Branch.test-GitVersionTask.Sha...
07:34:25 GitVersion_CommitDate 2019-11-06
07:34:25 GitVersion_AssemblySemVer 0.1.0.0
07:34:25 GitVersion_PreReleaseNumber 1
07:34:25
07:34:25
07:34:25 [Pipeline] echo
07:34:25 --- END SHARED LIBRARY STEP: dotnetTool ---
07:34:25 [Pipeline] powershell
07:34:26 Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
07:34:26 Copyright (C) Microsoft Corporation. All rights reserved.
07:34:26
07:34:27 C:\Users\ContainerAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.8\build\GitVersionTask.targets(10,9): error : Object reference not set to an instance of an object. [C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\Project1\testing.csproj]
07:34:27
07:34:27 Build FAILED.
07:34:27
07:34:27 C:\Users\ContainerAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.8\build\GitVersionTask.targets(10,9): error : Object reference not set to an instance of an object. [C:\jenkins\workspace\NuGet_testing_test_GitVersionTask\Project1\testing.csproj]
07:34:27 0 Warning(s)
07:34:27 1 Error(s)
07:34:27
07:34:27 Time Elapsed 00:00:00.95
07:34:35 [Pipeline] // stage
07:34:35 [Pipeline] stage
07:34:35 [Pipeline] { (Run unit tests)
07:34:35 Stage "Run unit tests" skipped due to earlier failure(s)
07:34:35 [Pipeline] }
07:34:35 [Pipeline] // stage
07:34:35 [Pipeline] stage
07:34:35 [Pipeline] { (Pack)
07:34:35 Stage "Pack" skipped due to earlier failure(s)
07:34:35 [Pipeline] }
07:34:36 [Pipeline] // stage
07:34:36 [Pipeline] stage
07:34:36 [Pipeline] { (Publish to Artifactory)
07:34:36 Stage "Publish to Artifactory" skipped due to earlier failure(s)
07:34:36 [Pipeline] }
07:34:36 [Pipeline] // stage
07:34:36 [Pipeline] }
07:34:36 [Pipeline] // withCredentials
07:34:36 [Pipeline] }
07:34:36 $ docker stop --time=1 8561441a43df25bf00412315c6febd235f217bb25fe5c67c778662354e6544de
07:34:42 $ docker rm -f 8561441a43df25bf00412315c6febd235f217bb25fe5c67c778662354e6544de
07:34:42 [Pipeline] // withDockerContainer
07:34:42 [Pipeline] }
07:34:42 [Pipeline] // withDockerRegistry
07:34:42 [Pipeline] }
07:34:42 [Pipeline] // withEnv
07:34:42 [Pipeline] }
07:34:42 [Pipeline] // withEnv
07:34:42 [Pipeline] }
07:34:42 [Pipeline] // node
07:34:42 [Pipeline] echo
07:34:42 --- SHARED LIBRARY STEP FAILED: buildNugetPackage ---
07:34:42 ====
07:34:42 Shared library exception reason:
07:34:42 ====
07:34:42 script returned exit code 1
07:34:42 --- END SHARED LIBRARY STEP: buildNugetPackage ---
07:34:42 [Pipeline] End of Pipeline
07:34:42 [GitLab Pipeline Status] Notifying branch build status: FAILED NuGet/testing/test%2FGitVersionTask: There was a failure building this commit
07:34:42 [GitLab Pipeline Status] Notified
07:34:42 ERROR: script returned exit code 1
07:34:42 Finished: FAILURE
I assume it has something to do with sparse checkout π€
Cannot repro locally with a sparse checkout.
Found the issue
Not sure how this produces null pointers:
https://github.com/GitTools/GitVersion/blob/e09622c19df4a1329d9cd9367c6662618fa4cb41/src/GitVersionCore/BuildServers/Jenkins.cs#L22
GitVersionTask.targets(10,9): error : NullReferenceException: Object reference not set to an instance of an object. [C:\jenkins\workspace\testing_test_gitVersionTaskAlpha\Project1\testing.csproj]
GitVersionTask.targets(10,9): error : at GitVersion.BuildServers.Jenkins.GenerateSetVersionMessage(VersionVariables variables) in C:\git\code\GitVersion\src\GitVersionCore\BuildServers\Jenkins.cs:line 22 [C:\jenkins\workspace\testing_test_gitVersionTaskAlpha\Project1\testing.csproj]
GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTaskExecutor.WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) in C:\git\code\GitVersion\src\GitVersionTask\GitVersionTaskExecutor.cs:line 70 [C:\jenkins\workspace\testing_test_gitVersionTaskAlpha\Project1\testing.csproj]
GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTasks.<>c__DisplayClass3_0.<WriteVersionInfoToBuildLog>b__0(IGitVersionTaskExecutor executor) in C:\git\code\GitVersion\src\GitVersionTask\GitVersionTasks.cs:line 18 [C:\jenkins\workspace\testing_test_gitVersionTaskAlpha\Project1\testing.csproj]
GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in C:\git\code\GitVersion\src\GitVersionTask\GitVersionTasks.cs:line 29 [C:\jenkins\workspace\testing_test_gitVersionTaskAlpha\Project1\testing.csproj]
GitVersionTask.targets(10,9): error : [C:\jenkins\workspace\testing_test_gitVersionTaskAlpha\Project1\testing.csproj]
@pannikbutton unsure how to repro in Azure, you could try https://github.com/GitTools/GitVersion/pull/1892/files to get a more verbose stack trace
I too have this issue, I want to provide more information where possible but I was ignored in #1876.
If one could explain how to get more verbose logs from the failure, I'd be happy to forward anything.
Downgrading to to 5.0.1 works. Updating to any newer version breaks.
hopefully once we have a nupkg of #1892 you should be able to get the detailed stack trace π
@pannikbutton, @casz, @Inzanit, there package with the stack trace enabled was published, can you try it and provide more details of the error?
@arturcic see my stacktrace: https://github.com/GitTools/GitVersion/issues/1883#issuecomment-550476990
Upgraded and got the following stack:
2019-11-07T07:57:49.5937811Z ##[error]C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(56,9): Error : NullReferenceException: Object reference not set to an instance of an object.
at GitVersion.MSBuildTask.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\1\s\src\GitVersionTask\GitVersionTaskExecutor.cs:line 29
at GitVersion.MSBuildTask.GitVersionTasks.<>c__DisplayClass0_0.<GetVersion>b__0(IGitVersionTaskExecutor executor) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 12
at GitVersion.MSBuildTask.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 29
2019-11-07T07:57:49.5947746Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(56,9): error : NullReferenceException: Object reference not set to an instance of an object. [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:57:49.5948252Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(56,9): error : at GitVersion.MSBuildTask.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\1\s\src\GitVersionTask\GitVersionTaskExecutor.cs:line 29 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:57:49.5948550Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(56,9): error : at GitVersion.MSBuildTask.GitVersionTasks.<>c__DisplayClass0_0.<GetVersion>b__0(IGitVersionTaskExecutor executor) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 12 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:57:49.5948819Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(56,9): error : at GitVersion.MSBuildTask.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 29 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:57:49.5949058Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(56,9): error : [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:57:49.6109809Z Done Building Project "d:\a\1\s\Redacted\Redacted.csproj" (default targets) -- FAILED.
Using default checkout options on Azure Pipelines @casz @arturcic
Additionally, I also received a ArgumentNullException, which I assume could be the product of the above error - however it is in a separate project from the one that produced the above stacktrace.
2019-11-07T07:58:06.8792870Z ##[error]C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): Error : ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at GitVersion.BuildServers.AzurePipelines.GenerateSetVersionMessage(VersionVariables variables) in D:\a\1\s\src\GitVersionCore\BuildServers\AzurePipelines.cs:line 48
at GitVersion.MSBuildTask.GitVersionTaskExecutor.WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) in D:\a\1\s\src\GitVersionTask\GitVersionTaskExecutor.cs:line 70
at GitVersion.MSBuildTask.GitVersionTasks.<>c__DisplayClass3_0.<WriteVersionInfoToBuildLog>b__0(IGitVersionTaskExecutor executor) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 18
at GitVersion.MSBuildTask.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 29
2019-11-07T07:58:06.8794678Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : ArgumentNullException: Value cannot be null. [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8795217Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : Parameter name: source [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8795881Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func) [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8796762Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : at GitVersion.BuildServers.AzurePipelines.GenerateSetVersionMessage(VersionVariables variables) in D:\a\1\s\src\GitVersionCore\BuildServers\AzurePipelines.cs:line 48 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8797332Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTaskExecutor.WriteVersionInfoToBuildLog(WriteVersionInfoToBuildLog task) in D:\a\1\s\src\GitVersionTask\GitVersionTaskExecutor.cs:line 70 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8797979Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTasks.<>c__DisplayClass3_0.<WriteVersionInfoToBuildLog>b__0(IGitVersionTaskExecutor executor) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 18 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8798394Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : at GitVersion.MSBuildTask.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\1\s\src\GitVersionTask\GitVersionTasks.cs:line 29 [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.8798896Z C:\Users\VssAdministrator\.nuget\packages\gitversiontask\5.1.2-beta1.11\build\GitVersionTask.targets(10,9): error : [d:\a\1\s\Redacted\Redacted.csproj]
2019-11-07T07:58:06.9820315Z Done Building Project "d:\a\1\s\Redacted\Redacted.csproj" (default targets) -- FAILED.
@casz @arturcic
@casz @Inzanit can you try version 5.1.2-beta.1+12? just add --verbosity normal do the dotnet build. I need the logs as well not only the error
@arturcic @casz @Inzanit After hours of trial and error and pulling out lots of hair, I can confirm the following:
Here are the steps to reproduce the error:
Screenshots of the build history of two repos, one public (repo1), one private (repo5):


Here is the log from the pipeline after updating GitVersionTask to 5.1.2-beta1.12 in the private repo:
VSBuild Log from Azure Devops using GitVersionTask 5.1.2-beta1.12.txt
Here is a link to the public project in Azure Devops, but since this error only occurs in private projects, you won't see it. But you could still have a look around at stuff like change history and the build config in the yaml file because it is an exact copy of the private repo that produces the error.
https://dev.azure.com/sandstorm-cloud/Alpha/_build?definitionId=26&_a=summary
That is a great investigation. It looks like when it runs for a private repo it tries to fetch
INFO [11/07/19 9:53:40:20] Fetching from remote 'origin' using
For azure pipeline it should not fetch by default, so I can go continue the investigation, thanks @pannikbutton
You're welcome, @arturcic. Glad I could be of some help.
@pannikbutton, @Inzanit, @casz can you try version 5.1.2-beta.1+18 and confirm it's working for you?
I can confirm both GitVersionTask and GitVersion.Tool perform as intended now on our Jenkins instance π
it works!
@arturcic Green! So much green everywhere! He he..
Yes. Confirmed. All working on my side.
Time to π’ π¦ π v5.1.2 π₯
Thank you all for the quick feedback and the time you spent helping me figuring out the cause of the error
Time to v5.1.2
That's the plan
Most helpful comment
That's the plan