-
Notifications
You must be signed in to change notification settings - Fork 564
Migrate WarnOnPreserveAttribute from ILLink step to MSBuild task #10675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Replace the ILLink custom step with an MSBuild task that runs before _RunILLink. This simplifies the build pipeline by removing a dependency on the ILLink step infrastructure while maintaining the same behavior. The new CheckForObsoletePreserveAttribute task uses System.Reflection.Metadata for fast metadata scanning instead of Mono.Cecil.
| <Target Name="_CheckForObsoletePreserveAttribute" BeforeTargets="_RunILLink"> | ||
| <CheckForObsoletePreserveAttribute Assemblies="@(ManagedAssemblyToLink)" /> | ||
| </Target> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was probably the way it was before...
But should this warn on all builds, or just Release builds? As-is, you'd only see it in Release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, maybe. I was aiming for parity with current behavior. I made a change that should run this one for all builds.
Just a heads up that I'm planning to migrate more steps - I'll probabliy default to running them only where ILLink runs to avoid impacting Release builds, but happy to take feedback.
Address PR feedback: move _CheckForObsoletePreserveAttribute target from ILLink.targets to AssemblyResolution.targets so it runs on all builds, not just Release/trimmed builds. This gives developers earlier feedback about using the obsolete attribute.
|
Ok, I guess it was working in NativeAOT before, because we run ILLink -> Ilc like iOS does. And the warning appeared in ILLink. |

Replace the ILLink custom step with an MSBuild task that runs before _RunILLink. This simplifies the build pipeline by removing a dependency on the ILLink step infrastructure while maintaining the same behavior.
The new CheckForObsoletePreserveAttribute task uses System.Reflection.Metadata for fast metadata scanning instead of Mono.Cecil.