Skip to content

GitVersion parsing fails with error #218

Description

@dennisdoomen

Usage Information

Fallout 10.3.45 and GitVersion 6.5 or higher

Description

System.Exception: Cannot parse GitVersion from output:

Reproduction Steps

Not sure if it's consistently reproducable. But it happened in FluentAssertions

Expected Behavior

No exception

Actual Behavior

10:27:34 [WRN] Could not inject value for Build.GitVersion
System.Exception: Cannot parse GitVersion from output:
{
  "AssemblySemFileVer": "8.10.1.0",
  "AssemblySemVer": "8.10.1.0",
  "BranchName": "switch-to-fallout",
  "BuildMetaData": 7,
  "CommitDate": "2026-05-26",
  "CommitsSinceVersionSource": 7,
  "EscapedBranchName": "switch-to-fallout",
  "FullBuildMetaData": "7.Branch.switch-to-fallout.Sha.6419fa509c7934f0b34a0ea5e5306c44c0a9a259",
  "FullSemVer": "8.10.1-switch-to-fallout.1+7",
  "InformationalVersion": "8.10.1-switch-to-fallout.1+7.Branch.switch-to-fallout.Sha.6419fa509c7934f0b34a0ea5e5306c44c0a9a259",
  "Major": 8,
  "MajorMinorPatch": "8.10.1",
  "Minor": 10,
  "Patch": 1,
  "PreReleaseLabel": "switch-to-fallout",
  "PreReleaseLabelWithDash": "-switch-to-fallout",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "switch-to-fallout.1",
  "PreReleaseTagWithDash": "-switch-to-fallout.1",
  "SemVer": "8.10.1-switch-to-fallout.1",
  "Sha": "6419fa509c7934f0b34a0ea5e5306c44c0a9a259",
  "ShortSha": "6419fa5",
  "UncommittedChanges": 13,
  "VersionSourceDistance": 7,
  "VersionSourceIncrement": "None",
  "VersionSourceSemVer": "8.10.0",
  "VersionSourceSha": "0954811776a71005283221b91aabafc5fec332b7",
  "WeightedPreReleaseNumber": 1
}
 ---> System.Exception: Cannot parse GitVersion output:
{
  "AssemblySemFileVer": "8.10.1.0",
  "AssemblySemVer": "8.10.1.0",
  "BranchName": "switch-to-fallout",
  "BuildMetaData": 7,
  "CommitDate": "2026-05-26",
  "CommitsSinceVersionSource": 7,
  "EscapedBranchName": "switch-to-fallout",
  "FullBuildMetaData": "7.Branch.switch-to-fallout.Sha.6419fa509c7934f0b34a0ea5e5306c44c0a9a259",
  "FullSemVer": "8.10.1-switch-to-fallout.1+7",
  "InformationalVersion": "8.10.1-switch-to-fallout.1+7.Branch.switch-to-fallout.Sha.6419fa509c7934f0b34a0ea5e5306c44c0a9a259",
  "Major": 8,
  "MajorMinorPatch": "8.10.1",
  "Minor": 10,
  "Patch": 1,
  "PreReleaseLabel": "switch-to-fallout",
  "PreReleaseLabelWithDash": "-switch-to-fallout",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "switch-to-fallout.1",
  "PreReleaseTagWithDash": "-switch-to-fallout.1",
  "SemVer": "8.10.1-switch-to-fallout.1",
  "Sha": "6419fa509c7934f0b34a0ea5e5306c44c0a9a259",
  "ShortSha": "6419fa5",
  "UncommittedChanges": 13,
  "VersionSourceDistance": 7,
  "VersionSourceIncrement": "None",
  "VersionSourceSemVer": "8.10.0",
  "VersionSourceSha": "0954811776a71005283221b91aabafc5fec332b7",
  "WeightedPreReleaseNumber": 1
}
 ---> System.Text.Json.JsonException: The JSON value could not be converted to Fallout.Common.Tools.GitVersion.GitVersion. Path: $.BuildMetaData | LineNumber: 4 | BytePositionInLine: 20.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
   at System.Text.Json.Utf8JsonReader.GetString()
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.TryReadAsObject(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, Object& value)
   at System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter`1.ReadAndCacheConstructorArgument(ReadStack& state, Utf8JsonReader& reader, JsonParameterInfo jsonParameterInfo)
   at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at Fallout.Common.Tooling.ProcessExtensions.StdToJson[T](IEnumerable`1 output) in /_/src/Fallout.Tooling/ProcessExtensions.cs:line 55
   at Fallout.Common.Tools.GitVersion.GitVersionTasks.GetResult[T](ToolOptions options, IReadOnlyCollection`1 output) in /_/src/Fallout.Common/Tools/GitVersion/GitVersionTasks.cs:line 21
   --- End of inner exception stack trace ---
   at Fallout.Common.Tools.GitVersion.GitVersionTasks.GetResult[T](ToolOptions options, IReadOnlyCollection`1 output) in /_/src/Fallout.Common/Tools/GitVersion/GitVersionTasks.cs:line 25
   at Fallout.Common.Tooling.ToolTasks.Run[TOptions,TResult](TOptions options) in /_/src/Fallout.Tooling/ToolTasks.Run.cs:line 49
   --- End of inner exception stack trace ---
   at Fallout.Common.Tooling.ToolTasks.Run[TOptions,TResult](TOptions options) in /_/src/Fallout.Tooling/ToolTasks.Run.cs:line 54
   at Fallout.Common.Tools.GitVersion.GitVersionTasks.GitVersion(Configure`1 configurator) in /_/src/Fallout.Common/Tools/GitVersion/GitVersion.Generated.cs:line 33
   at Fallout.Common.Tools.GitVersion.GitVersionAttribute.GetValue(MemberInfo member, Object instance) in /_/src/Fallout.Common/Tools/GitVersion/GitVersionAttribute.cs:line 46
   at Fallout.Common.ValueInjection.ValueInjectionAttributeBase.TryGetValue(MemberInfo member, Object instance) in /_/src/Fallout.Build/Execution/Extensibility/ValueInjectionAttributeBase.cs:line 23
Member 'GitVersion' is required to be not null or empty

Regression?

Unknown

Known Workarounds

Unknown

Could you help with a pull-request?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions