Add Uri.UriSchemeData constant#123147
Merged
Merged
Conversation
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new constant UriSchemeData = "data" to the System.Uri class to enable developers to reference the data: scheme without hardcoding string literals, following the pattern established for other URI schemes.
Changes:
- Added
UriSchemeDataconstant to the implementation in System.Private.Uri - Added corresponding reference assembly declaration in System.Runtime
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Private.Uri/src/System/Uri.cs | Adds the UriSchemeData = "data" constant at the end of the URI scheme constants list |
| src/libraries/System.Runtime/ref/System.Runtime.cs | Adds the UriSchemeData declaration in alphabetical order in the reference assembly |
Contributor
|
Tagging subscribers to this area: @dotnet/ncl |
MihaZupan
approved these changes
Jan 13, 2026
stephentoub
reviewed
Jan 13, 2026
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
stephentoub
approved these changes
Jan 13, 2026
MihaZupan
approved these changes
Jan 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
UriSchemeDataconstant toSystem.Urifordata:URIs, following the pattern established in .NET 6 for adding scheme constants.Changes:
UriSchemeDatafield toSystem.Private.Uri/src/System/Uri.cswith XML documentation commentSystem.Runtime/ref/System.Runtime.csCustomer Impact
Enables use of
Uri.UriSchemeDatainstead of hardcoding"data"when working with data URIs.Regression
No, this is a new API addition.
Testing
All existing Uri tests pass. Build succeeds with 0 warnings and 0 errors.
Risk
Minimal. Additive API only—no behavioral changes to existing code.
Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.
Original prompt
Uri.UriSchemeData#122020💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.