Skip to content

GH2160: Set application exit code #2161

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

Merged
merged 2 commits into from
Mar 9, 2020
Merged

GH2160: Set application exit code #2161

merged 2 commits into from
Mar 9, 2020

Conversation

gitfool
Copy link
Contributor

@gitfool gitfool commented Mar 7, 2020

Fixes #2160.

@gitfool
Copy link
Contributor Author

gitfool commented Mar 7, 2020

@arturcic did I break some other tests? Not sure what to do there.

@arturcic
Copy link
Member

arturcic commented Mar 7, 2020

I think we need some integration tests that reproduce the issue with the current behavior, then to have a fix that makes the test green again, what do you think?

@gitfool
Copy link
Contributor Author

gitfool commented Mar 7, 2020

Is this failure actually expected given my change?

@gitfool
Copy link
Contributor Author

gitfool commented Mar 7, 2020

If you point me in the right direction, I'll try to add an integration test.

@arturcic
Copy link
Member

arturcic commented Mar 7, 2020

@gitfool
Copy link
Contributor Author

gitfool commented Mar 7, 2020

So it looks like those integration tests already check the exit code, and I changed the last one in this PR, since it flipped from zero to non-zero after this change. I think it's enough to have at least some tests that check the exit code. Is there something more specific you want to test for here?

And I'm still not sure why the docker tests are failing. Any ideas?

@arturcic
Copy link
Member

arturcic commented Mar 7, 2020

So it looks like those integration tests already check the exit code, and I changed the last one in this PR, since it flipped from zero to non-zero after this change. I think it's enough to have at least some tests that check the exit code. Is there something more specific you want to test for here?

And I'm still not sure why the docker tests are failing. Any ideas?

Nope, no idea, I think we can postpone this issue after the release of 5.2.0, what do you think?

@gitfool
Copy link
Contributor Author

gitfool commented Mar 7, 2020

Sure. I'd rather have 5.2.0. 😛

@gitfool
Copy link
Contributor Author

gitfool commented Mar 7, 2020

@arturcic rebasing this PR after you released 5.2.0 seems to have fixed the docker tests.

Kinda makes sense given the tests were failing with errors like:

Error: One or more errors occurred. (Assert.Equal() Failure
            ↓ (pos 2)
Expected: 5.2.0-PullRequest2161.387
Actual:   5.1.4-pull-2161-merge.1+241
            ↑ (pos 2))
	Assert.Equal() Failure
            ↓ (pos 2)
Expected: 5.2.0-PullRequest2161.387
Actual:   5.1.4-pull-2161-merge.1+241
            ↑ (pos 2)

@arturcic arturcic self-assigned this Mar 8, 2020
@arturcic arturcic added the bug label Mar 8, 2020
@arturcic arturcic added this to the 5.2.1 milestone Mar 8, 2020
@gitfool
Copy link
Contributor Author

gitfool commented Mar 8, 2020

Raw Cake logs from GitHub Actions captured before this change:

2020-03-08T19:54:06.3489920Z Executing: dotnet tool install "GitVersion.Tool" --tool-path "/home/runner/work/build-cake/build-cake/tools" --version 5.2.0 --verbosity diagnostic
...
2020-03-08T19:54:11.2637801Z Compiling build script...
2020-03-08T19:54:14.6725618Z Executing: /home/runner/work/build-cake/build-cake/tools/dotnet-gitversion -output json -verbosity Debug
2020-03-08T19:54:15.0174076Z INFO [03/08/20 19:54:14:85] Applicable build agent found: 'GitHubActions'.
2020-03-08T19:54:15.0175089Z INFO [03/08/20 19:54:14:86] Working directory: /home/runner/work/build-cake/build-cake
2020-03-08T19:54:15.0175749Z INFO [03/08/20 19:54:14:86] IsDynamicGitRepository: False
2020-03-08T19:54:15.0176554Z INFO [03/08/20 19:54:14:87] Returning Project Root from DotGitDirectory: /home/runner/work/build-cake/build-cake/.git/ - /home/runner/work/build-cake/build-cake/
2020-03-08T19:54:15.0176960Z INFO [03/08/20 19:54:14:87] Running on Unix.
2020-03-08T19:54:15.0177551Z INFO [03/08/20 19:54:14:87] Applicable build agent found: 'GitHubActions'.
2020-03-08T19:54:15.0177942Z INFO [03/08/20 19:54:14:87] Branch from build environment: 
2020-03-08T19:54:15.0178518Z INFO [03/08/20 19:54:14:87] Begin: Normalizing git directory for branch ''
2020-03-08T19:54:15.0179170Z   INFO [03/08/20 19:54:14:89] One remote found (origin -> 'https://github.com/pharos/build-cake').
2020-03-08T19:54:15.0179680Z   INFO [03/08/20 19:54:14:89] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
2020-03-08T19:54:15.0180283Z   INFO [03/08/20 19:54:14:90] Creating local branch from remote tracking 'refs/remotes/origin/gitversion-beta'.
2020-03-08T19:54:15.0180869Z   INFO [03/08/20 19:54:14:92] Creating local branch from remote tracking 'refs/remotes/origin/master'.
2020-03-08T19:54:15.0181455Z   INFO [03/08/20 19:54:14:92] HEAD is detached and points at commit '4db6004ad2f28e1dddd8b860a16807e1b33922fe'.
2020-03-08T19:54:15.0181796Z   INFO [03/08/20 19:54:14:92] Local Refs:
2020-03-08T19:54:15.0182459Z refs/heads/gitversion-beta (47baf212136dc5049cb9378655d23db34eac2d12)
...
2020-03-08T19:54:15.0263502Z refs/tags/9.1.0 (6bdfd58ace86a6a3757766a18591fe4a54fcc356)
2020-03-08T19:54:15.0263920Z   INFO [03/08/20 19:54:14:93] No local branch pointing at the commit '4db6004ad2f28e1dddd8b860a16807e1b33922fe'. Fake branch needs to be created.
2020-03-08T19:54:15.0264215Z   INFO [03/08/20 19:54:14:93] Fetching remote refs to see if there is a pull request ref
2020-03-08T19:54:15.0264546Z   INFO [03/08/20 19:54:14:96] End: Normalizing git directory for branch '' (Took: 89.44ms)
2020-03-08T19:54:15.0264744Z   ERROR [03/08/20 19:54:14:97] An unexpected error occurred:
2020-03-08T19:54:15.0264927Z LibGit2Sharp.LibGit2SharpException: this remote has never connected
2020-03-08T19:54:15.0265064Z    at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
2020-03-08T19:54:15.0265201Z    at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote)
2020-03-08T19:54:15.0265350Z    at LibGit2Sharp.Network.ListReferencesInternal(String url, CredentialsHandler credentialsProvider)
2020-03-08T19:54:15.0265489Z    at LibGit2Sharp.Network.ListReferences(Remote remote)
2020-03-08T19:54:15.0265643Z    at GitVersion.Helpers.GitRepositoryHelper.GetRemoteTipsForAnonymousUser(IRepository repo, Remote remote) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 262
2020-03-08T19:54:15.0265852Z    at GitVersion.Helpers.GitRepositoryHelper.CreateFakeBranchPointingAtThePullRequestTip(ILog log, IRepository repo, AuthenticationInfo authentication) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 201
2020-03-08T19:54:15.0266074Z    at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 111
2020-03-08T19:54:15.0266278Z    at GitVersion.GitPreparer.NormalizeGitDirectory(AuthenticationInfo auth, String targetBranch, String gitDirectory, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitPreparer.cs:line 190
2020-03-08T19:54:15.0266454Z    at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitPreparer.cs:line 65
2020-03-08T19:54:15.0266619Z    at GitVersion.GitVersionCalculator.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersionCore\GitVersionCalculator.cs:line 52
2020-03-08T19:54:15.0266784Z    at GitVersion.ExecCommand.Execute() in D:\a\GitVersion\GitVersion\src\GitVersionExe\ExecCommand.cs:line 39
2020-03-08T19:54:15.0266938Z    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\GitVersion\GitVersion\src\GitVersionExe\GitVersionExecutor.cs:line 55
2020-03-08T19:54:15.0267092Z   INFO [03/08/20 19:54:14:97] Attempting to show the current git graph (please include in issue): 
2020-03-08T19:54:15.0267230Z   INFO [03/08/20 19:54:14:97] Showing max of 100 commits
...
2020-03-08T19:54:15.0702227Z Error: System.AggregateException: One or more errors occurred. (Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.)
2020-03-08T19:54:15.0702938Z  ---> System.Runtime.Serialization.SerializationException: Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.
2020-03-08T19:54:15.0703157Z    at System.Runtime.Serialization.XmlObjectSerializerReadContext.HandleMemberNotFound(XmlReaderDelegator xmlReader, ExtensionDataObject extensionData, Int32 memberIndex)
2020-03-08T19:54:15.0703411Z    at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.GetJsonMemberIndex(XmlReaderDelegator xmlReader, XmlDictionaryString[] memberNames, Int32 memberIndex, ExtensionDataObject extensionData)
2020-03-08T19:54:15.0703661Z    at ReadGitVersionFromJson(XmlReaderDelegator , XmlObjectSerializerReadContextComplexJson , XmlDictionaryString , XmlDictionaryString[] )
2020-03-08T19:54:15.0703871Z    at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
2020-03-08T19:54:15.0704075Z    at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context)
2020-03-08T19:54:15.0704289Z    at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)
2020-03-08T19:54:15.0704493Z    at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)
2020-03-08T19:54:15.0704717Z    at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)
2020-03-08T19:54:15.0704921Z    at System.Runtime.Serialization.Json.DataContractJsonSerializerImpl.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
2020-03-08T19:54:15.0705119Z    at System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
2020-03-08T19:54:15.0705326Z    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
2020-03-08T19:54:15.0705537Z    at System.Runtime.Serialization.Json.DataContractJsonSerializerImpl.ReadObject(XmlDictionaryReader reader)
2020-03-08T19:54:15.0705716Z    at System.Runtime.Serialization.Json.DataContractJsonSerializerImpl.ReadObject(Stream stream)
2020-03-08T19:54:15.0705890Z    at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(Stream stream)
2020-03-08T19:54:15.0706077Z    at Cake.Common.Tools.GitVersion.GitVersionRunner.Run(GitVersionSettings settings) in C:\projects\cake\src\Cake.Common\Tools\GitVersion\GitVersionRunner.cs:line 65
2020-03-08T19:54:15.0706523Z    at Cake.Common.Tools.GitVersion.GitVersionAliases.GitVersion(ICakeContext context, GitVersionSettings settings) in C:\projects\cake\src\Cake.Common\Tools\GitVersion\GitVersionAliases.cs:line 121
2020-03-08T19:54:15.0707019Z    at Submission#0.Version..ctor(BuildSystem buildSystem, ICakeContext context) in /home/runner/work/build-cake/build-cake/scripts/version.cake:line 10
2020-03-08T19:54:15.0707427Z    at Submission#0.Builder.SetVersion() in /home/runner/work/build-cake/build-cake/scripts/builder.cake:line 297
2020-03-08T19:54:15.0707881Z    at Submission#0.Builder..ctor(BuildSystem buildSystem, ICakeContext context, Action`1 runTarget) in /home/runner/work/build-cake/build-cake/scripts/builder.cake:line 9
2020-03-08T19:54:15.0708405Z    at Submission#0.<<Initialize>>d__0.MoveNext() in /home/runner/work/build-cake/build-cake/scripts/bootstrap.cake:line 20
2020-03-08T19:54:15.0708856Z --- End of stack trace from previous location where exception was thrown ---
2020-03-08T19:54:15.0709058Z    at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
2020-03-08T19:54:15.0709284Z    at Microsoft.CodeAnalysis.Scripting.Script`1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
2020-03-08T19:54:15.0709620Z    --- End of inner exception stack trace ---
2020-03-08T19:54:15.0709792Z    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
2020-03-08T19:54:15.0710000Z    at Cake.Scripting.Roslyn.RoslynScriptSession.Execute(Script script) in C:\projects\cake\src\Cake\Scripting\Roslyn\RoslynScriptSession.cs:line 136
2020-03-08T19:54:15.0710202Z    at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments) in C:\projects\cake\src\Cake.Core\Scripting\ScriptRunner.cs:line 219
2020-03-08T19:54:15.0710397Z    at Cake.Commands.BuildCommand.Execute(CakeOptions options) in C:\projects\cake\src\Cake\Commands\BuildCommand.cs:line 41
2020-03-08T19:54:15.0710580Z    at Cake.CakeApplication.Run(CakeOptions options) in C:\projects\cake\src\Cake\CakeApplication.cs:line 45
2020-03-08T19:54:15.0714552Z    at Cake.Program.Main() in C:\projects\cake\src\Cake\Program.cs:line 80
2020-03-08T19:54:15.0880234Z ##[error]Process completed with exit code 1.

Raw Cake logs from GitHub Actions captured after this change:

2020-03-08T20:05:55.3727229Z Executing: dotnet tool install "GitVersion.Tool" --tool-path "/home/runner/work/build-cake/build-cake/tools" --version 5.3.0-gh2160-1.3 --verbosity diagnostic
...
2020-03-08T20:07:22.2866064Z Compiling build script...
2020-03-08T20:07:26.4656209Z Executing: /home/runner/work/build-cake/build-cake/tools/dotnet-gitversion -output json -verbosity Debug
2020-03-08T20:07:26.9227375Z INFO [03/08/20 20:07:26:70] Applicable build agent found: 'GitHubActions'.
2020-03-08T20:07:26.9228453Z INFO [03/08/20 20:07:26:71] Working directory: /home/runner/work/build-cake/build-cake
2020-03-08T20:07:26.9228924Z INFO [03/08/20 20:07:26:71] IsDynamicGitRepository: False
2020-03-08T20:07:26.9229714Z INFO [03/08/20 20:07:26:72] Returning Project Root from DotGitDirectory: /home/runner/work/build-cake/build-cake/.git/ - /home/runner/work/build-cake/build-cake/
2020-03-08T20:07:26.9230131Z INFO [03/08/20 20:07:26:72] Running on Unix.
2020-03-08T20:07:26.9230759Z INFO [03/08/20 20:07:26:72] Applicable build agent found: 'GitHubActions'.
2020-03-08T20:07:26.9231174Z INFO [03/08/20 20:07:26:72] Branch from build environment: 
2020-03-08T20:07:26.9232015Z INFO [03/08/20 20:07:26:73] Begin: Normalizing git directory for branch ''
2020-03-08T20:07:26.9232690Z   INFO [03/08/20 20:07:26:76] One remote found (origin -> 'https://github.com/pharos/build-cake').
2020-03-08T20:07:26.9233140Z   INFO [03/08/20 20:07:26:76] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
2020-03-08T20:07:26.9233766Z   INFO [03/08/20 20:07:26:78] Creating local branch from remote tracking 'refs/remotes/origin/gitversion-beta'.
2020-03-08T20:07:26.9234368Z   INFO [03/08/20 20:07:26:80] Creating local branch from remote tracking 'refs/remotes/origin/master'.
2020-03-08T20:07:26.9234987Z   INFO [03/08/20 20:07:26:80] HEAD is detached and points at commit '0d9e085535df59721ae47df0a26b3a42a3e0a873'.
2020-03-08T20:07:26.9235346Z   INFO [03/08/20 20:07:26:81] Local Refs:
2020-03-08T20:07:26.9236041Z refs/heads/gitversion-beta (82be0c668e08c44d900db2d64e543058ca075d5e)
...
2020-03-08T20:07:26.9325399Z refs/tags/9.1.0 (6bdfd58ace86a6a3757766a18591fe4a54fcc356)
2020-03-08T20:07:26.9325845Z   INFO [03/08/20 20:07:26:82] No local branch pointing at the commit '0d9e085535df59721ae47df0a26b3a42a3e0a873'. Fake branch needs to be created.
2020-03-08T20:07:26.9326153Z   INFO [03/08/20 20:07:26:83] Fetching remote refs to see if there is a pull request ref
2020-03-08T20:07:26.9326563Z   INFO [03/08/20 20:07:26:86] End: Normalizing git directory for branch '' (Took: 137.58ms)
2020-03-08T20:07:26.9326744Z   ERROR [03/08/20 20:07:26:88] An unexpected error occurred:
2020-03-08T20:07:26.9326961Z LibGit2Sharp.LibGit2SharpException: this remote has never connected
2020-03-08T20:07:26.9327128Z    at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
2020-03-08T20:07:26.9327290Z    at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote)
2020-03-08T20:07:26.9327475Z    at LibGit2Sharp.Network.ListReferencesInternal(String url, CredentialsHandler credentialsProvider)
2020-03-08T20:07:26.9327747Z    at LibGit2Sharp.Network.ListReferences(Remote remote)
2020-03-08T20:07:26.9327945Z    at GitVersion.Helpers.GitRepositoryHelper.GetRemoteTipsForAnonymousUser(IRepository repo, Remote remote) in C:\projects\gitversion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 262
2020-03-08T20:07:26.9328191Z    at GitVersion.Helpers.GitRepositoryHelper.CreateFakeBranchPointingAtThePullRequestTip(ILog log, IRepository repo, AuthenticationInfo authentication) in C:\projects\gitversion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 201
2020-03-08T20:07:26.9331719Z    at GitVersion.Helpers.GitRepositoryHelper.NormalizeGitDirectory(ILog log, IEnvironment environment, String gitDirectory, AuthenticationInfo authentication, Boolean noFetch, String currentBranch, Boolean isDynamicRepository) in C:\projects\gitversion\src\GitVersionCore\Helpers\GitRepositoryHelper.cs:line 111
2020-03-08T20:07:26.9331990Z    at GitVersion.GitPreparer.NormalizeGitDirectory(AuthenticationInfo auth, String targetBranch, String gitDirectory, Boolean isDynamicRepository) in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 190
2020-03-08T20:07:26.9332219Z    at GitVersion.GitPreparer.Prepare(Boolean normalizeGitDirectory, String currentBranch, Boolean shouldCleanUpRemotes) in C:\projects\gitversion\src\GitVersionCore\GitPreparer.cs:line 65
2020-03-08T20:07:26.9332429Z    at GitVersion.GitVersionCalculator.CalculateVersionVariables() in C:\projects\gitversion\src\GitVersionCore\GitVersionCalculator.cs:line 52
2020-03-08T20:07:26.9332616Z    at GitVersion.ExecCommand.Execute() in C:\projects\gitversion\src\GitVersionExe\ExecCommand.cs:line 39
2020-03-08T20:07:26.9332802Z    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in C:\projects\gitversion\src\GitVersionExe\GitVersionExecutor.cs:line 55
2020-03-08T20:07:26.9332987Z   INFO [03/08/20 20:07:26:88] Attempting to show the current git graph (please include in issue): 
2020-03-08T20:07:26.9333160Z   INFO [03/08/20 20:07:26:88] Showing max of 100 commits
...
2020-03-08T20:07:26.9394965Z Error: System.AggregateException: One or more errors occurred. (GitVersion: Process returned an error (exit code 1).)
2020-03-08T20:07:26.9395362Z  ---> Cake.Core.CakeException: GitVersion: Process returned an error (exit code 1).
2020-03-08T20:07:26.9395552Z    at Cake.Core.Tooling.Tool`1.ProcessExitCode(Int32 exitCode) in C:\projects\cake\src\Cake.Core\Tooling\Tool.cs:line 141
2020-03-08T20:07:26.9395772Z    at Cake.Core.Tooling.Tool`1.Run(TSettings settings, ProcessArgumentBuilder arguments, ProcessSettings processSettings, Action`1 postAction) in C:\projects\cake\src\Cake.Core\Tooling\Tool.cs:line 119
2020-03-08T20:07:26.9395980Z    at Cake.Common.Tools.GitVersion.GitVersionRunner.Run(GitVersionSettings settings) in C:\projects\cake\src\Cake.Common\Tools\GitVersion\GitVersionRunner.cs:line 61
2020-03-08T20:07:26.9396186Z    at Cake.Common.Tools.GitVersion.GitVersionAliases.GitVersion(ICakeContext context, GitVersionSettings settings) in C:\projects\cake\src\Cake.Common\Tools\GitVersion\GitVersionAliases.cs:line 121
2020-03-08T20:07:26.9396649Z    at Submission#0.Version..ctor(BuildSystem buildSystem, ICakeContext context) in /home/runner/work/build-cake/build-cake/scripts/version.cake:line 10
2020-03-08T20:07:26.9397059Z    at Submission#0.Builder.SetVersion() in /home/runner/work/build-cake/build-cake/scripts/builder.cake:line 297
2020-03-08T20:07:26.9397524Z    at Submission#0.Builder..ctor(BuildSystem buildSystem, ICakeContext context, Action`1 runTarget) in /home/runner/work/build-cake/build-cake/scripts/builder.cake:line 9
2020-03-08T20:07:26.9397953Z    at Submission#0.<<Initialize>>d__0.MoveNext() in /home/runner/work/build-cake/build-cake/scripts/bootstrap.cake:line 20
2020-03-08T20:07:26.9398397Z --- End of stack trace from previous location where exception was thrown ---
2020-03-08T20:07:26.9398608Z    at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
2020-03-08T20:07:26.9398839Z    at Microsoft.CodeAnalysis.Scripting.Script`1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
2020-03-08T20:07:26.9399182Z    --- End of inner exception stack trace ---
2020-03-08T20:07:26.9399353Z    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
2020-03-08T20:07:26.9399547Z    at Cake.Scripting.Roslyn.RoslynScriptSession.Execute(Script script) in C:\projects\cake\src\Cake\Scripting\Roslyn\RoslynScriptSession.cs:line 136
2020-03-08T20:07:26.9399832Z    at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments) in C:\projects\cake\src\Cake.Core\Scripting\ScriptRunner.cs:line 219
2020-03-08T20:07:26.9400026Z    at Cake.Commands.BuildCommand.Execute(CakeOptions options) in C:\projects\cake\src\Cake\Commands\BuildCommand.cs:line 41
2020-03-08T20:07:26.9400212Z    at Cake.CakeApplication.Run(CakeOptions options) in C:\projects\cake\src\Cake\CakeApplication.cs:line 45
2020-03-08T20:07:26.9400385Z    at Cake.Program.Main() in C:\projects\cake\src\Cake\Program.cs:line 80
2020-03-08T20:07:26.9504576Z ##[error]Process completed with exit code 1.

As shown, the obscure exception reported by Cake changed from:

System.Runtime.Serialization.SerializationException: Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''.

to the more relevant:

Cake.Core.CakeException: GitVersion: Process returned an error (exit code 1).

Copy link
Member

@arturcic arturcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@arturcic arturcic merged commit e1a2f0c into GitTools:master Mar 9, 2020
@arturcic
Copy link
Member

arturcic commented Mar 9, 2020

thank you so much for your contributions 👍 @gitfool

@gitfool gitfool deleted the gh2160 branch March 9, 2020 17:41
@arturcic
Copy link
Member

🎉 This issue has been resolved in version 5.2.1 🎉
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 this pull request may close these issues.

GitVersionApp should set exit code
2 participants