Migrate WarnOnPreserveAttribute from ILLink step to MSBuild task#10675
Closed
sbomer wants to merge 2 commits intodotnet:mainfrom
Closed
Migrate WarnOnPreserveAttribute from ILLink step to MSBuild task#10675sbomer wants to merge 2 commits intodotnet:mainfrom
sbomer wants to merge 2 commits intodotnet:mainfrom
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.
Comment on lines
+103
to
+105
| <Target Name="_CheckForObsoletePreserveAttribute" BeforeTargets="_RunILLink"> | ||
| <CheckForObsoletePreserveAttribute Assemblies="@(ManagedAssemblyToLink)" /> | ||
| </Target> |
Member
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
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.
Member
|
Ok, I guess it was working in NativeAOT before, because we run ILLink -> Ilc like iOS does. And the warning appeared in ILLink. |
grendello
approved these changes
Jan 12, 2026
Member
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
Member
|
/azp run |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
Member
Author
|
/azp run |
|
Commenter does not have sufficient privileges for PR 10675 in repo dotnet/android |
Member
Author
|
Moved to #10693 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.