Skip to content

[Operational Issue]: SB_*_Offline_CurrentSourceBuiltSdk  legs fail deterministically —  OverlaySdkOnLKG  can't find  BundledVersions.props  due to  +<sha>  build metadata in SDK version #7901

Closed

Description

@dkurepa

Error

error : Could not find a part of the path
'/__w/_temp/previously-source-built-sdk/sdk/11.0.100-preview.7.26371.117+766c39a8f28bfdbfb61e7a6ed570b5e94c28c831/Microsoft.NETCoreSdk.BundledVersions.props'
at OverrideAndCreateBundledNETCoreAppPackageVersion.Execute()
in .../src/sdk/src/Tasks/sdk-tasks/OverrideAndCreateBundledNETCoreAppPackageVersion.cs:line 31

Links

https://dev.azure.com/dnceng/internal/_build/results?buildId=3028468&view=logs&j=3d049f34-eb7f-5dcd-1393-71cd43c7f766&t=45d72956-3e0b-5778-cfc5-8be904beeb27

Root Cause

unknown

Blocking

  • This issue is blocking

Affected Releases

  • .NET 11
  • main

Activity

  1. mthalman commented on Jul 22, 2026

    @mthalman
    Member

    Root cause

    dotnet/sdk#55329 enabled the NativeAOT implementation of the dotnet CLI in source-built SDKs. This changed which code handles dotnet --version.

    The NativeAOT CLI’s --version action prints Product.Version. Product.Version normally reads the SDK version from its .version file. If that file cannot be found, it falls back to the assembly informational version.

    Under NativeAOT, AppContext.BaseDirectory is the .NET installation root, rather than the selected versioned SDK directory. Consequently, the .version lookup fails and Product.Version uses the fallback.

    For official builds, MSBuild appends the source revision to the informational version:

    <Target Name="AddSourceRevisionToInformationalVersion"
    DependsOnTargets="GetAssemblyVersion;InitializeSourceControlInformation"
    Condition="'$(SourceControlInformationFeatureSupported)' == 'true' and '$(IncludeSourceRevisionInInformationalVersion)' == 'true'">
    <PropertyGroup Condition="'$(SourceRevisionId)' != ''">
    <!-- Follow SemVer 2.0 rules -->
    <_InformationalVersionContainsPlus>false</_InformationalVersionContainsPlus>
    <_InformationalVersionContainsPlus Condition="$(InformationalVersion.Contains('+'))">true</_InformationalVersionContainsPlus>
    <InformationalVersion Condition="!$(_InformationalVersionContainsPlus)">$(InformationalVersion)+$(SourceRevisionId)</InformationalVersion>
    <InformationalVersion Condition="$(_InformationalVersionContainsPlus)">$(InformationalVersion).$(SourceRevisionId)</InformationalVersion>

    Therefore, dotnet --version reports:

    11.0.100-preview.7.26371.117+766c39a8f28bfdbfb61e7a6ed570b5e94c28c831
    

    The SDK’s actual directory does not include the SemVer build metadata:

    sdk/11.0.100-preview.7.26371.117/
    

    During Stage 2, OverlaySdkOnLKG.targets captures the raw output of dotnet --version. It then uses that value as an SDK directory name:

    <OverrideAndCreateBundledNETCoreAppPackageVersion
    Stage0BundledVersionsPath="$(_DotNetHiveRoot)/sdk/$(Stage0SdkVersion)/Microsoft.NETCoreSdk.BundledVersions.props"
    Stage2BundledVersionsPath="$(TestHostDotNetRoot)/sdk/$(Version)/Microsoft.NETCoreSdk.BundledVersions.props"/>

    That produces a path that does not exist:

    sdk/11.0.100-preview.7.26371.117+766c39a8.../
    

    Why the PR’s Stage 2 build passed

    The PR did run a genuine Stage 2 build. However, it was a CI build using the simplified 11.0.100-ci versioning pattern. The fallback value still matched the physical sdk/11.0.100-ci/ directory, so the bug remained hidden.

    The official build added the source-revision metadata, exposing the invalid assumption that dotnet --version can always be used directly as an SDK directory name.

  2. baronfel commented on Jul 22, 2026

    @baronfel
    Member

    This should be an easy fix - we already have a mechanism for locating 'the versioned SDK root directory' in the SdkPaths class, we just need to use it on this code path.

  3. added theissue type on Jul 22, 2026
  4. dkurepa commented on Jul 24, 2026

    @dkurepa
    MemberAuthor

    Thanks, looks like this fixed p7. We're still waiting for the main FF to merge

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions