-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Suppressing RequiresDynamicCodeAttribute for Compiled Regex #67299
Closed
Closed
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
Before we can place it on a class we need to:
RequiresAssemblyFiles
cannot be placed on a class, but it can be placed on a property. We're currently not very consistent on the applicability of these. Maybe we don't need to be? (AllowingRequiresUnreferencedCode
/RequiresDynamicCode
on properties is going to be bunch of work, for example)If this pull request takes a dependency on this, it will be blocked until all of the above is validated/happens.
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.
I think the main value of this PR is that we are dogfooding the system we are putting in place and finding all the holes before customers will find them.
no public APIs are going to get these annotations. So really this is just for our internal code.
The alternatives to waiting would be:
2.Suppress the warnings at the low level places like the original suggestion.
I could live with 1 for a while as long as we ensured we supported class level in .NET 7. We would also use that in JSON and DependencyInjection, since both of those libraries have whole classes just for generating IL.
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.
I like 1 - unless @LakshanF has a different opinion, let's create an issue tracking the 3 things above (API review, validate/implement Roslyn analyzer/add a test for it, validate/implement in NativeAOT and add a test for it, and undo workaround from this pull request). For this pull request, add RDC on the individual methods instead of on the class.
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.
Option 1 as mentioned above would require some churn - the warnings come from static read only fields that would require a longer workarounds that will need to be spilled into methods in the class - that we expect to be temporary anyway.
I like @eerhardt thinking of this PR as flushing out initial issues with the annotation process and created an API request for enhancing the attribute. I would like to explore that path (including compiler changes ) in more detail first since its the solution we eventually likely go with before going for the temporary long workaround with option 1.