You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attribute is not needed in .NET6 and can interfere with official .NET linker attributes. The linker is able to recognize and mark reflection patterns automatically and for custom scenarios better attribute is supported https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.dynamicdependencyattribute. The assembly-level attribute handling is not needed either as that's the default .net6 behavior.
We'll need to update the generator to not generate the Preserve attribute first: #19524
Current plan:
.NET 12: remove all our own [Preserve] usages, and obsolete the attribute (show a warning when the attribute is used - [Obsolete ("...")])
.NET 13: show an error when the attribute is used, but existing binaries still work ([Obsolete ("...", IsError: true)]), show a build-time warning if such binaries are found ("won't work in future releases")
.NET 14: remove support for binaries with the attribute, keep showing a warning if such binaries are found (but change the message to "is ignored, nothing is preserved")
Activity
rolfbjarne commentedon Jul 9, 2026
This will be easier once we've removed the custom trimmer steps, so let's wait until then.