5.3.0 breaks global.json with latestFeature · Issue #739 · actions/setup-dotnet · GitHub
Skip to content

5.3.0 breaks global.json with latestFeature #739

Closed

Description

@otemnov

Description:
action for the following global.json is broken, seems because of this change

{
  "sdk": {
    "version": "8.0",
    "rollForward": "latestFeature"
  }
}

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
Use global.json without feature version specified

{
  "sdk": {
    "version": "8.0",
    "rollForward": "latestFeature"
  }
}

Expected behavior:
Should setup dotnet with no issues

Actual behavior:
Error: Cannot read properties of undefined (reading 'substring')

Activity

  1. changed the title [-]5.3.0[/-] [+]5.3.0 breaks global.json with latestFeature[/+] on May 28, 2026
  2. v-priyagupta108 commented on May 28, 2026

    @v-priyagupta108
    Contributor

    Hello @otemnov,
    Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

  3. Frulfump commented on May 28, 2026

    @Frulfump

    8.0 isn't a valid version according to the docs for global.json https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#version

    version

    Type: string

    The version of the .NET SDK to use.

    This field:

    Requires the full version number, such as 10.0.100.
    Doesn't support version numbers like 10, 10.0, or 10.0.x.
    Doesn't have wildcard support.
    Doesn't support version ranges.

  4. nikita-bestuzhev-ct commented on May 28, 2026

    @nikita-bestuzhev-ct

    @Frulfump, it sounds reasonable, thanks.
    But in this case some validation should be introduced in getVersionFromGlobalJson function. To have something like "Version number '8.0' is not valid. The feature part is missing" instead of "Cannot read properties of undefined (reading 'substring')".

  5. Frulfump commented on May 28, 2026

    @Frulfump

    @Frulfump, it sounds reasonable, thanks.
    But in this case some validation should be introduced in getVersionFromGlobalJson function. To have something like "Version number '8.0' is not valid. The feature part is missing" instead of "Cannot read properties of undefined (reading 'substring')".

    Yupp I agree 100%

  6. v-priyagupta108 commented on May 28, 2026

    @v-priyagupta108
    Contributor

    Hi @otemnov, thanks for reporting this.

    The sdk.version value in global.json must be a full SDK version, such as 8.0.100. Values like 8, 8.0, or 8.0.x are not supported. So the provided repro with "version": "8.0" is not a valid global.json configuration.

    For more details, please see the official documentation: https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#version

    In v5.3.0, the action expanded its use of global.json to support rollForward policies, which requires parsing version components such as major, minor, and feature band as defined in Microsoft’s spec.

    We will improve the action’s handling so invalid global.json SDK version cases like this fail with a clearer error message. We’ll track this as an error-handling improvement rather than a regression in supported global.json behavior.

    To unblock yourself, update your global.json to use a complete SDK version: "version": "8.0.100"

    Hope this helps!

  7. otemnov commented on May 28, 2026

    @otemnov
    Author

    @priyagupta108 thanks for quick reaction! this isn't a blocker for us, we've already pinned to a full SDK version on our side. The reason I filed the issue is that "version": "8.0" had been working fine until v5.3.0, so the silent break was a bit surprising. On our side, it was a useful nudge to fix an broken global.json.

  8. v-priyagupta108 commented on Jun 12, 2026

    @v-priyagupta108
    Contributor

    Hi @otemnov, we’ve added the version validation discussed in #742.

    The action now validates the sdk.version format when rollForward is specified and returns a clear error message instead of the cryptic Cannot read properties of undefined (reading 'substring') error.

    We’re validating the fix now and plan to get #742 merged soon.

  9. Frulfump commented on Jun 12, 2026

    @Frulfump

    From the docs https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#matching-rules

    If a global.json file is found and it specifies an SDK version:

    If no rollForward value is set, it uses patch as the default rollForward policy.

    So it should always validate the version.

  10. v-priyagupta108 commented on Jun 18, 2026

    @v-priyagupta108
    Contributor

    Hi @otemnov , this issue has been fixed by merging #742.

    The action now validates the sdk.version format when rollForward is specified, in accordance with the global.json documentation: https://learn.microsoft.com/en-us/dotnet/core/tools/global-json#version

    With this change, invalid version formats now return a clear validation error message instead of the cryptic error.


    To start using this fix immediately, you can reference the actions/setup-dotnet@main branch in your workflows for now. The changes will also be included in an upcoming release.


    We are closing this issue now. Please let us know if you continue to see any issues or need any further assistance.
    

    Thank you for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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