PeachDrawing.Core

PeachDrawing.Core

RUri Class

Wraps System.Uri for use throughout resource loading, adding special-case handling for data: URIs and helpers for resolving a relative URI against a base URI.

public class RUri

Inheritance System.Object → RUri

Remarks

Before .NET 10, a data: URI is deliberately never handed to System.Uri. Two independent reasons, both measured on net8.0: it cannot round-trip one correctly through AbsoluteUri, and it rejects any URI string longer than 65,519 characters (“Invalid URI: The Uri string is too long.”). That ceiling is roughly 48 KB of payload once base64 expansion is accounted for, which real embedded logos, photographs and charts exceed routinely; the System.UriFormatException is caught upstream and turned into a skipped resource, so the only symptom is an image that silently renders blank. Holding the original string instead removes the ceiling.

On .NET 10 and later neither reason holds: System.Uri round-trips a data: URI exactly and has no length ceiling at all (measured: a 5,000,023-character payload constructs successfully). It also percent-escapes a non-base64 payload, which holding the raw string does not — data:text/plain,Hello World! comes back with the space escaped there and verbatim before .NET 10. So the bypass is gated: .NET 10 keeps using System.Uri, which is both correct and strictly better, and only the older targets take the string-holding path they actually need.

Constructors  
RUri(RUri, RUri) Resolves uri against baseUri, the same way a relative href/src/url() reference is resolved against a document’s base URL.
RUri(RUri, string) Resolves uri against baseUri, the same way a relative href/src/url() reference is resolved against a document’s base URL.
RUri(string) Parses uriString as either an absolute or relative URI.
RUri(string, UriKind) Parses uriString as the given uriKind.
RUri(Uri) Wraps an existing System.Uri instance.
Properties  
AbsoluteUri The fully escaped absolute URI string.
IsAbsoluteUri Whether this instance represents an absolute URI.
IsFile Whether this URI refers to a local file.
OriginalString The original, unescaped URI string as it was parsed.
Scheme The URI scheme (e.g. https, file, data).
Uri The underlying System.Uri.