Skip to content

NuGet.RestoreEx.targets "Object reference not set" during tvos RuntimeTests restore #126461

Open

Description

@kotlarmilos

Build Information

Build: https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_build/results?buildId=1362636
Build error leg or test failing: Build Tests step in tvos-arm64 Release AllSubsets_CoreCLR_RuntimeTests and tvos-arm64 Release AllSubsets_Mono_RuntimeTests
Pull request: #125441

Affected CI jobs: build_tvos_arm64_Release_AllSubsets_CoreCLR_RuntimeTests, build_tvos_arm64_Release_AllSubsets_Mono_RuntimeTests

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "NuGet.RestoreEx.targets(19,5): error : Object reference not set to an instance of an object",
  "ErrorPattern": "",
  "BuildRetry": true,
  "ExcludeConsoleLog": true
}

Summary

NuGet restore fails with a NullReferenceException in MSBuildStaticGraphRestore.GetDependencyGraphSpec during RuntimeTests build on tvos legs:

.dotnet/sdk/11.0.100-preview.3.26170.106/NuGet.RestoreEx.targets(19,5): error : Object reference not set to an instance of an object.
   at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.<GetDependencyGraphSpec>b__37_3(RestoreProjectAdapter project)
   at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.<>c__DisplayClass38_0`1.<GetDependencyGraphSpec>b__0(KeyValuePair`2 project)

Note

This issue was filed with the assistance of GitHub Copilot.

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1362636
Error message validated: [NuGet.RestoreEx.targets(19,5): error : Object reference not set to an instance of an object]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 4/2/2026 10:17:33 AM UTC

Report

💡 View the full list of hits in the Build Insights portal

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

Activity

  1. added
    Known Build Error
    on Apr 2, 2026
  2. added
    untriaged
    on Apr 2, 2026
  3. dotnet-policy-service commented on Apr 2, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/runtime-infrastructure
    See info in area-owners.md if you want to be subscribed.

  4. danmoseley commented on Apr 8, 2026

    @danmoseley
    Contributor

    This appears to be a known NuGet static graph restore bug — NuGet/Home#11680 — where OuterBuild is null for a referenced multi-targeting project because MSBuild's ProjectGraph omits the outer build node. I've posted a detailed analysis and a proposed interim fix there: NuGet/Home#11680

    Why this hits tvOS specifically

    The tvOS runtime tests build configuration likely references a project that multi-targets (e.g. TargetFrameworks including a tvOS TFM alongside another). When the project graph only contains inner build nodes for that dependency (no outer build evaluation), NuGet's new PackageSpecFactory code path dereferences the null OuterBuild property and throws an NRE.

    The 3 hits/month likely reflects how often the tvOS leg runs rather than intermittency — the bug should be deterministic for a given project graph topology.

    Note

    This analysis was produced with the assistance of GitHub Copilot, prompted by @danmoseley.

  5. olstakh commented on May 6, 2026

    @olstakh

    We're hitting the same error when using BenchmarkDotNet framework. It builds optimized projects on the fly to run benchmarks, and some of the projects have multiple TF. Is there a workaround, apart from TF manipulation?

  6. added this to the 12.0.0 milestone on Jul 14, 2026
  7. removed
    untriaged
    on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Known Build Errorarea-Infrastructure

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions