Skip to content

Commit 7d31424

Browse files
Copilotgewarren
andcommitted
Add NuGet package ID validation breaking change documentation for .NET 10 RC 1
Co-authored-by: gewarren <[email protected]>
1 parent 03152eb commit 7d31424

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
@@ -118,6 +118,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
118118
| [PrunePackageReference privatizes direct prunable references](sdk/10.0/prune-packagereference-privateassets.md) | Behavioral change | Preview 7 |
119119
| [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 |
120120
| [NUGET_ENABLE_ENHANCED_HTTP_RETRY environment variable removed](sdk/10.0/nuget-enhanced-http-retry-removed.md) | Behavioral change | Preview 6 |
121+
| [NuGet logs an error for invalid package IDs](sdk/10.0/nuget-packageid-validation.md) | Behavioral change | RC 1 |
121122

122123
## Windows Forms
123124

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: 01/06/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+
With the new change, any package ID used to construct a URL via NuGet resources is now validated. If the package ID does not 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 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+
If you need to bypass the new validation, you can set the environment variable `NUGET_DISABLE_PACKAGEID_VALIDATION` to `true` in your environment. This will disable the package ID validation logic and restore the previous behavior.
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
@@ -138,6 +138,8 @@ items:
138138
href: sdk/10.0/http-warnings-to-errors.md
139139
- name: NUGET_ENABLE_ENHANCED_HTTP_RETRY environment variable removed
140140
href: sdk/10.0/nuget-enhanced-http-retry-removed.md
141+
- name: NuGet logs an error for invalid package IDs
142+
href: sdk/10.0/nuget-packageid-validation.md
141143
- name: Windows Forms
142144
items:
143145
- name: API obsoletions

0 commit comments

Comments
 (0)