[release/9.0] Add missing [RequiresDynamicCode] attributes to System.Linq.Expressions API in ref assembly#107638
Merged
jeffschwMSFT merged 8 commits intorelease/9.0from Sep 12, 2024
Conversation
Calling Expression.Lambda without a delegate type isn't AOT compatible. Fix this by passing the delegate type.
|
Note regarding the |
|
Note regarding the |
Contributor
|
Tagging subscribers to this area: @cston |
eerhardt
approved these changes
Sep 12, 2024
jeffschwMSFT
approved these changes
Sep 12, 2024
Member
jeffschwMSFT
left a comment
There was a problem hiding this comment.
approved. we can merge when ready
2 tasks
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.
Backport of #107580 to release/9.0
/cc @eerhardt @cston
Customer Impact
When customers use the native AOT Roslyn Analyzer to find AOT incompatible code, they are not getting the warnings correctly for System.Linq.Expressions. This degrades the value of the Roslyn Analyzer.
By adding these attributes to the
refassemblies, this allows the Roslyn Analyzers to work correctly and raise warnings where customer code is calling AOT-incompatible APIs.Regression
[If yes, specify when the regression was introduced. Provide the PR or commit if known.]
Testing
The change to Microsoft.Extensions.DependencyInjection in our repo was because the Roslyn Analyzer found a place where we were calling an incompatible API. This verifies that the ref assembly is correctly attributed.
All existing automated tests pass.
Risk
Low. The change to Linq.Expressions is only to put the matching attributes in the ref assembly from the implementation assembly. This only affects compilation and won't affect runtime behavior. The change to Microsoft.Extensions.DependencyInjection was verified by existing tests and is in code that is only used in
netstandard2.0builds, not in .NET Framework or .NET Core builds.