Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

UriComponents.Path documentation implies LocalPath is always returned, but this is only true for file:// URIs

Aperta Adatta ai principianti
#13,039 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
documentation

Direzione di ricerca

Apri il file sorgente UriComponents.xml collegato nell’issue e individua la descrizione di Path. Confrontane la formulazione con gli esempi forniti di file:// e https://, quindi aggiorna la documentazione in modo che il comportamento per le URI file e non-file sia chiaro. Verifica che la pagina API generata rifletta la distinzione corretta.

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

Descrizione

untriaged
Type of issue

Missing information

Description

UriComponents.Path documentation implies LocalPath is always returned, but this is only true for file:// URIs`

The documentation for UriComponents.Path currently says:

Path: The LocalPath data.

This wording suggests (by omission) that LocalPath is always returned, regardless of URI scheme.
However, this is only true for file:// URIs.
For all non-file URIs (e.g., http://, https://, ftp://), UriComponents.Path returns the URL path, not LocalPath.

This leads to incorrect expectations about path formatting, especially regarding Windows-style backslashes.

Below is a minimal reproducible example demonstrating the actual behavior.

Reproduction Code

var http = new Uri("https://example.com/a/b/c.txt");
var file = new Uri("file://server/share/c.txt");

Console.WriteLine(http.GetComponents(UriComponents.Path, UriFormat.Unescaped));
Console.WriteLine(http.LocalPath);

Console.WriteLine(file.GetComponents(UriComponents.Path, UriFormat.Unescaped));
Console.WriteLine(file.LocalPath);

// The example displays the following output:
// a/b/c.txt
// /a/b/c.txt
// share/c.txt
// \\server\share\c.txt
Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.uricomponents?view=net-10.0

Content source URL

https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System/UriComponents.xml

Document Version Independent Id

3d232e61-f2cd-8a85-f974-beb7ecade43c

Platform Id

be57ca08-cf67-4666-bdce-208a89903395

Article author

@dotnet-bot

Lingua principale
C#
Stelle
954
Fork
1.7k
Merge medio
1g 16h
PR unite (30g)
30

Preparare l'ambiente

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 dotnet/dotnet-api-docs

Tutte le issue di dotnet/dotnet-api-docs

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.