-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
This DefaultValueAttribute
constructor is not supported with trimming and will throw an exception if reached at runtime in a trimmed app. It is however possible to disable the exception throwing mechanism and it might sometimes work when doing this.
We're removing DynamicallyAccessedMembers
on this attribute constructor and the number of cases when this works might go down.
Version
.NET 10
Previous 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 chance the code will 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
- Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
- Behavioral change: Existing binaries might behave differently at run time.
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.
Feature area
Core .NET libraries
Affected APIs
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status