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

Aperta
#714 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp, rust

Direzione di ricerca

Inizia in xtask/src/tasks/bindings/csharp.rs intorno alle righe 506–514 e riproduci il problema con cargo xtask test-csharp --release --nuget-dir

mentre api.nuget.org non è raggiungibile. Leggi bindings/csharp/nuget.config e la validazione NU1101 esistente per comprendere le opzioni di gestione disponibili. Il lavoro è completato quando la verifica si comporta come documentato negli ambienti con rete limitata, senza mascherare errori di restore non correlati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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}"
    ));
}
Lingua principale
Rust
Stelle
375
Fork
81
Merge medio
1g 11h
PR unite (30g)
78

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/regorus

Tutte le issue di microsoft/regorus

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.