microsoft / microsoft/regorus

xtask test-csharp: source mapping verification fails when nuget.org is unreachable

Open
#714 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
346
Forks
75
Avg merge
1d 3h
Merged PRs (30d)
15

Description

Problem

The source mapping verification in cargo xtask test-csharp (in xtask/src/tasks/bindings/csharp.rs) expects dotnet restore to fail with NU1101 (package not found) to confirm that Microsoft.Regorus cannot be resolved from external sources via package source mapping.

However, in environments where api.nuget.org is unreachable (e.g., air-gapped CI, restricted networks, corporate proxies), the restore fails with NU1301 (unable to load service index) instead. The verification then treats this as an unexpected failure and aborts.

Expected Behavior

The verification should handle the case where the external source is unreachable. Possible approaches:

  1. Accept NU1301 as evidence that external resolution is blocked (though this is weaker — it proves unreachability, not that source mapping works).
  2. Add a CLI flag or environment variable (e.g., --skip-source-mapping-verify or REGORUS_SKIP_SOURCE_MAPPING_VERIFY) to allow skipping the verification in environments where it cannot succeed.
  3. Allow the nuget.org URL in bindings/csharp/nuget.config to be overridden (e.g., via an environment variable or additional CLI option) so users can point it at a reachable mirror.

Reproduction

Run cargo xtask test-csharp --release --nuget-dir <dir> in an environment where https://api.nuget.org/v3/index.json is not accessible.

Relevant Code

xtask/src/tasks/bindings/csharp.rs, lines 506–514:

// Ensure the failure is specifically NU1101 for Microsoft.Regorus, not an
// unrelated error (e.g. network outage).
        "Source mapping verification failed: dotnet restore failed, but not for the \
         expected reason. Expected NU1101 for Microsoft.Regorus to confirm external \
         resolution is blocked.\nstdout:\n{stdout}\nstderr:\n{stderr}"
    ));
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in xtask/src/tasks/bindings/csharp.rs around lines 506–514 and reproduce with cargo xtask test-csharp --release --nuget-dir

while api.nuget.org is unreachable. Read bindings/csharp/nuget.config and the existing NU1101 validation to understand the available handling options. Done means the verification behaves as documented in restricted-network environments without masking unrelated restore failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, rust
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.