Skip to content

Commit 7ab263e

Browse files
authored
Document ProviderAliasAttribute breaking change (#46274)
1 parent ec29fb9 commit 7ab263e

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

docs/core/compatibility/10.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
3434
| [MacCatalyst version normalization](core-libraries/10.0/maccatalyst-version-normalization.md) | Behavioral change | Preview 1 |
3535
| [System.Linq.AsyncEnumerable included in core libraries](core-libraries/10.0/asyncenumerable.md) | Source incompatible | Preview 1 |
3636

37+
## Extensions
38+
39+
| Title | Type of change | Introduced version |
40+
|-----------------------------------------------------------------------------------------------------------|---------------------|--------------------|
41+
| [ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions assembly](extensions/10.0/provideraliasattribute-moved-assembly.md) | Source incompatible | Preview 4 |
42+
3743
## Globalization
3844

3945
| Title | Type of change | Introduced version |
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "Breaking change: ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions assembly"
3+
description: Learn about the breaking change in .NET 10 where the ProviderAliasAttribute class moved from the Microsoft.Extensions.Logging assembly to the Microsoft.Extensions.Logging.Abstractions assembly.
4+
ms.date: 05/19/2025
5+
---
6+
7+
# ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions
8+
9+
The <xref:Microsoft.Extensions.Logging.ProviderAliasAttribute> attribute has been moved from the `Microsoft.Extensions.Logging` assembly to the `Microsoft.Extensions.Logging.Abstractions` assembly.
10+
11+
## Version introduced
12+
13+
.NET 10 Preview 4
14+
15+
## Previous behavior
16+
17+
In previous versions of .NET, <xref:Microsoft.Extensions.Logging.ProviderAliasAttribute> was defined in the `Microsoft.Extensions.Logging` assembly.
18+
19+
## New behavior
20+
21+
Starting in .NET 10, <xref:Microsoft.Extensions.Logging.ProviderAliasAttribute> is defined in `Microsoft.Extensions.Logging.Abstractions` and, to maintain compatibility, is type-forwarded from `Microsoft.Extensions.Logging`.
22+
23+
## Type of breaking change
24+
25+
This change can affect [source compatibility](../../categories.md#source-compatibility).
26+
27+
## Reason for change
28+
29+
This change allows applications that depend on [Microsoft.Extensions.Logging.Abstractions](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions) and that use <xref:Microsoft.Extensions.Logging.ProviderAliasAttribute> to avoid taking a dependency on the full [Microsoft.Extensions.Logging package](https://www.nuget.org/packages/Microsoft.Extensions.Logging).
30+
31+
## Recommended action
32+
33+
In most scenarios, no action is required. The type is [type-forwarded](../../../../standard/assembly/type-forwarding.md) from `Microsoft.Extensions.Logging` to `Microsoft.Extensions.Logging.Abstractions`, which allows existing code to continue to work without modification.
34+
35+
The only potential breaking scenario occurs when your project references an older version of `Microsoft.Extensions.Logging` alongside the .NET 10 version of `Microsoft.Extensions.Logging.Abstractions`. In this situation, a compilation error might occur due to <xref:Microsoft.Extensions.Logging.ProviderAliasAttribute> being defined in both assemblies. To resolve the error, upgrade to the .NET 10 version of `Microsoft.Extensions.Logging`.
36+
37+
## Affected APIs
38+
39+
- <xref:Microsoft.Extensions.Logging.ProviderAliasAttribute?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ items:
3838
href: cryptography/10.0/x509-publickey-null.md
3939
- name: Environment variable renamed to DOTNET_OPENSSL_VERSION_OVERRIDE
4040
href: cryptography/10.0/version-override.md
41+
- name: Extensions
42+
items:
43+
- name: "ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions assembly"
44+
href: extensions/10.0/provideraliasattribute-moved-assembly.md
4145
- name: Globalization
4246
items:
4347
- name: Environment variable renamed to DOTNET_ICU_VERSION_OVERRIDE
@@ -1746,6 +1750,10 @@ items:
17461750
href: /ef/core/what-is-new/ef-core-3.x/breaking-changes?toc=/dotnet/core/compatibility/toc.json&bc=/dotnet/breadcrumb/toc.json
17471751
- name: Extensions
17481752
items:
1753+
- name: .NET 10
1754+
items:
1755+
- name: "ProviderAliasAttribute moved to Microsoft.Extensions.Logging.Abstractions assembly"
1756+
href: extensions/10.0/provideraliasattribute-moved-assembly.md
17491757
- name: .NET 8
17501758
items:
17511759
- name: ActivatorUtilities.CreateInstance behaves consistently

0 commit comments

Comments
 (0)