From 36d1db2d53b3d256ea6c55140775129549b41d74 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 22:24:43 +0000 Subject: [PATCH 1/4] Initial plan From 1a834527cb233b81c91b0bd844be09a7a9effeea Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 Aug 2025 22:33:44 +0000 Subject: [PATCH 2/4] Add breaking change documentation for DefaultValueAttribute DynamicallyAccessedMembers removal Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- docs/core/compatibility/10.0.md | 1 + ...eattribute-dynamically-accessed-members.md | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 6406589933843..0d71b29038ef0 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -39,6 +39,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | [ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change](core-libraries/10.0/activity-sampling.md) | Behavioral change | Preview 1 | | [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 | | [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 | +| [DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers](core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md) | Binary incompatible/source incompatible | Preview 1 | | [Default trace context propagator updated to W3C standard](core-libraries/10.0/default-trace-context-propagator.md) | Behavioral change | Preview 4 | | [DriveInfo.DriveFormat returns Linux filesystem types](core-libraries/10.0/driveinfo-driveformat-linux.md) | Behavioral change | Preview 6 | | [GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default](core-libraries/10.0/tar-atime-ctime-default.md) | Behavioral change | Preview 5 | diff --git a/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md b/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md new file mode 100644 index 0000000000000..668525e2b2687 --- /dev/null +++ b/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md @@ -0,0 +1,38 @@ +--- +title: "Breaking change: DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers" +description: "Learn about the breaking change in .NET 10 where DefaultValueAttribute(System.Type type, string? value) constructor is no longer annotated with DynamicallyAccessedMembers." +ms.date: 01/30/2025 +ai-usage: ai-assisted +--- + +# DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers + +The constructor is no longer annotated with . This constructor is not supported with trimming and will throw an exception if reached at runtime in a trimmed app. + +## Version introduced + +.NET 10 + +## Previous behavior + +If the constructor was used in a trimmed app and the feature switch to disable exception throwing was used, publishing the app would generate a trimming warning and there was a chance the code would work at runtime. + +## New behavior + +If the constructor is used in a trimmed app and the feature switch to disable exception throwing is used, publishing the app will generate a trimming warning and there's a smaller chance the code will work at runtime. + +## Type of breaking change + +This change can affect [binary compatibility](../../categories.md#binary-compatibility) and [source compatibility](../../categories.md#source-compatibility). + +## Reason for change + +This attribute should not be used in trimmed apps because it doesn't reliably work. Trimming should be free to remove type members mentioned in the attribute. + +## Recommended action + +Do not enable the feature switch that attempts to make this attribute (unreliably) work in trimmed apps. + +## Affected APIs + +- From 831d030e00174bfe19c80869f95647b220b898fa Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:49:47 -0700 Subject: [PATCH 3/4] human edits --- docs/core/compatibility/10.0.md | 2 +- ...eattribute-dynamically-accessed-members.md | 20 +++++++++---------- docs/core/compatibility/toc.yml | 2 ++ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 0d71b29038ef0..3fc2827fd91ef 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -39,7 +39,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | [ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change](core-libraries/10.0/activity-sampling.md) | Behavioral change | Preview 1 | | [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 | | [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 | -| [DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers](core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md) | Binary incompatible/source incompatible | Preview 1 | +| [DefaultValueAttribute constructor no longer annotated with DynamicallyAccessedMembers](core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md) | Binary/source incompatible | Preview 7 | | [Default trace context propagator updated to W3C standard](core-libraries/10.0/default-trace-context-propagator.md) | Behavioral change | Preview 4 | | [DriveInfo.DriveFormat returns Linux filesystem types](core-libraries/10.0/driveinfo-driveformat-linux.md) | Behavioral change | Preview 6 | | [GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default](core-libraries/10.0/tar-atime-ctime-default.md) | Behavioral change | Preview 5 | diff --git a/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md b/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md index 668525e2b2687..08e7ae4048bf6 100644 --- a/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md +++ b/docs/core/compatibility/core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md @@ -1,25 +1,25 @@ --- -title: "Breaking change: DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers" -description: "Learn about the breaking change in .NET 10 where DefaultValueAttribute(System.Type type, string? value) constructor is no longer annotated with DynamicallyAccessedMembers." -ms.date: 01/30/2025 +title: "Breaking change: 'DynamicallyAccessedMembers' annotation removed from 'DefaultValueAttribute' ctor" +description: "Learn about the breaking change in .NET 10 where a 'DefaultValueAttribute' constructor is no longer annotated with 'DynamicallyAccessedMembers'." +ms.date: 08/11/2025 ai-usage: ai-assisted --- -# DefaultValueAttribute(System.Type type, string? value) constructor no longer annotated with DynamicallyAccessedMembers +# `DynamicallyAccessedMembers` annotation removed from `DefaultValueAttribute` ctor -The constructor is no longer annotated with . This constructor is not supported with trimming and will throw an exception if reached at runtime in a trimmed app. +The constructor is no longer annotated with . This constructor is not supported with trimming and throws an exception if reached at run time in a trimmed app. ## Version introduced -.NET 10 +.NET 10 Preview 7 ## Previous behavior -If the constructor was used in a trimmed app and the feature switch to disable exception throwing was used, publishing the app would generate a trimming warning and there was a chance the code would work at runtime. +Previously, if the constructor was used in a trimmed app and the feature switch to disable exception throwing was used, publishing the app generated a trimming warning, and there was a chance the code worked at run time. ## New behavior -If the constructor is used in a trimmed app and the feature switch to disable exception throwing is used, publishing the app will generate a trimming warning and there's a smaller chance the code will work at runtime. +Starting in .NET 10, if the constructor is used in a trimmed app and the feature switch to disable exception throwing is used, publishing the app still generates a trimming warning. But there's a smaller chance the code will work at run time. ## Type of breaking change @@ -31,8 +31,8 @@ This attribute should not be used in trimmed apps because it doesn't reliably wo ## Recommended action -Do not enable the feature switch that attempts to make this attribute (unreliably) work in trimmed apps. +Don't enable the feature switch that attempts to make (unreliably) work in trimmed apps. ## Affected APIs -- +- diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 9f99fed62c5cb..dc1cf6fedf993 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -40,6 +40,8 @@ items: href: core-libraries/10.0/default-trace-context-propagator.md - name: DriveInfo.DriveFormat returns Linux filesystem types href: core-libraries/10.0/driveinfo-driveformat-linux.md + - name: DynamicallyAccessedMembers annotation removed from DefaultValueAttribute ctor + href: core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md - name: GnuTarEntry and PaxTarEntry exclude atime and ctime by default href: core-libraries/10.0/tar-atime-ctime-default.md - name: LDAP DirectoryControl parsing is now more stringent From b187309ae633c7899813154097e70d3c83c0bf46 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:51:55 -0700 Subject: [PATCH 4/4] placement --- docs/core/compatibility/10.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 3fc2827fd91ef..acea12efdbcb7 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -39,9 +39,9 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af | [ActivitySource.CreateActivity and ActivitySource.StartActivity behavior change](core-libraries/10.0/activity-sampling.md) | Behavioral change | Preview 1 | | [C# 14 overload resolution with span parameters](core-libraries/10.0/csharp-overload-resolution.md) | Behavioral change | Preview 1 | | [Consistent shift behavior in generic math](core-libraries/10.0/generic-math.md) | Behavioral change | Preview 1 | -| [DefaultValueAttribute constructor no longer annotated with DynamicallyAccessedMembers](core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md) | Binary/source incompatible | Preview 7 | | [Default trace context propagator updated to W3C standard](core-libraries/10.0/default-trace-context-propagator.md) | Behavioral change | Preview 4 | | [DriveInfo.DriveFormat returns Linux filesystem types](core-libraries/10.0/driveinfo-driveformat-linux.md) | Behavioral change | Preview 6 | +| [DynamicallyAccessedMembers annotation removed from DefaultValueAttribute ctor](core-libraries/10.0/defaultvalueattribute-dynamically-accessed-members.md) | Binary/source incompatible | Preview 7 | | [GnuTarEntry and PaxTarEntry no longer includes atime and ctime by default](core-libraries/10.0/tar-atime-ctime-default.md) | Behavioral change | Preview 5 | | [LDAP DirectoryControl parsing is now more stringent](core-libraries/10.0/ldap-directorycontrol-parsing.md) | Behavioral change | Preview 1 | | [MacCatalyst version normalization](core-libraries/10.0/maccatalyst-version-normalization.md) | Behavioral change | Preview 1 |