-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Remove warning for base type with RequiresUnreferencedCode #117944
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
Conversation
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.
Pull Request Overview
This PR removes IL2109 warnings that occurred when a type without RequiresUnreferencedCode (RUC) derived from a type with RUC. The change makes the behavior consistent between RequiresUnreferencedCode and RequiresDynamicCode, where the latter did not have this warning. The warning is considered unnecessary because constructor calls to the base type will still generate appropriate warnings.
- Removes IL2109 diagnostic code generation from multiple components (ILLink, Roslyn analyzer, and NativeAOT compiler)
- Updates test cases to remove expected IL2109 warnings and related suppressions
- Adds a new test file to verify the behavior with base classes having RUC/RDC attributes
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
DiagnosticId.cs |
Marks IL2109 diagnostic ID as unused |
MarkStep.cs |
Removes logic that generates IL2109 warnings for base type inheritance |
RequiresUnreferencedCodeAnalyzer.cs |
Removes Roslyn analyzer logic for IL2109 warnings |
DataflowAnalyzedTypeDefinitionNode.cs |
Removes NativeAOT compiler logic for IL2109 warnings |
RequiresOnClass.cs |
Removes expected IL2109 warnings from test cases and updates class names |
RequiresOnBaseClass.cs |
New test file demonstrating expected behavior with RUC/RDC base classes |
GenericParameterDataFlow.cs |
Removes expected IL2109 warning from generic type test |
RequiresCapabilityTests.cs |
Adds test method for new RequiresOnBaseClass test case |
SuppressWarningsViaXml.xml |
Removes IL2109 suppression attribute from XML configuration |
Tagging subscribers to this area: @dotnet/illink |
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.
LGTM, thank you!
Not needed in this PR, but for the unused warnings, should we remove the related unused strings from the .xlf
s?
/ba-g "timeouts" |
Removes the IL2109 warning about a type without RUC derived from a type with RUC. This existed for RequiresUnreferencedCode but not RequiresDynamicCode.
The warning on the class should not be necessary because there will be a warning for the base ctor call.
Fixes #107660.