Skip to content

Commit 00192e9

Browse files
authored
Add NuGet package ID validation breaking change documentation for .NET 10 RC 1 (#48284)
1 parent ff543ed commit 00192e9

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
121121
| [PrunePackageReference privatizes direct prunable references](sdk/10.0/prune-packagereference-privateassets.md) | Behavioral change | Preview 7 |
122122
| [HTTP warnings promoted to errors in `dotnet package list` and `dotnet package search`](sdk/10.0/http-warnings-to-errors.md) | Behavioral/source incompatible change | Preview 4 |
123123
| [NUGET_ENABLE_ENHANCED_HTTP_RETRY environment variable removed](sdk/10.0/nuget-enhanced-http-retry-removed.md) | Behavioral change | Preview 6 |
124+
| [NuGet logs an error for invalid package IDs](sdk/10.0/nuget-packageid-validation.md) | Behavioral change | RC 1 |
124125

125126
## Windows Forms
126127

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "Breaking change: NuGet logs an error for invalid package IDs"
3+
description: "Learn about the breaking change in .NET 10 where NuGet validates package IDs when constructing URLs and throws exceptions for invalid formats."
4+
ms.date: 09/08/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/47984
7+
---
8+
# NuGet logs an error for invalid package IDs
9+
10+
NuGet now validates package IDs when they're used to create URLs in .NET 10. If a package ID isn't in the correct format, NuGet shows an error instead of continuing. This ensures only valid package IDs are used when constructing URLs.
11+
12+
## Version introduced
13+
14+
.NET 10 RC 1
15+
16+
## Previous behavior
17+
18+
Previously, NuGet resources that constructed URLs from package IDs did not validate the package ID format. Invalid or malformed package IDs could be used without triggering validation errors.
19+
20+
## New behavior
21+
22+
Starting with the .NET 10 SDK, any package ID used to construct a URL via NuGet resources is now validated. If the package ID doesn't conform to NuGet's expected format, an exception is thrown, and the URL is not constructed.
23+
24+
## Type of breaking change
25+
26+
This change is a [behavioral change](../../categories.md#behavioral-change).
27+
28+
## Reason for change
29+
30+
This change introduces validation to ensure that only properly formatted package IDs are used when constructing URLs. The validation strengthens the code's security posture by reducing the risk of unsafe or unintended inputs being processed.
31+
32+
## Recommended action
33+
34+
To disable the package ID validation logic and restore the previous behavior, you can set the environment variable `NUGET_DISABLE_PACKAGEID_VALIDATION` to `true`.
35+
36+
## Affected APIs
37+
38+
None.

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ items:
144144
href: sdk/10.0/http-warnings-to-errors.md
145145
- name: NUGET_ENABLE_ENHANCED_HTTP_RETRY environment variable removed
146146
href: sdk/10.0/nuget-enhanced-http-retry-removed.md
147+
- name: NuGet logs an error for invalid package IDs
148+
href: sdk/10.0/nuget-packageid-validation.md
147149
- name: Windows Forms
148150
items:
149151
- name: API obsoletions

0 commit comments

Comments
 (0)