-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
RequiresAssemblyFilesAttribute is not always checked and applied correctly #54154
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @agocke, @vitek-karas, @VSadov Issue DetailsThere are cases like https://github.com/dotnet/runtime/blob/main/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs#L255 where APIs which is not supported in single-file setup are not issuing any warnings when used. What is also strange is that the APIs which are annotated but have override don't need the annotation either, for example, https://github.com/dotnet/runtime/blob/main/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs#L77
|
Isn't this tracked in dotnet/linker#1985? I think there's a pull request with the fix in flight. |
Do you think? In this case the method is already annotated but no warning is issued (it could be build issue) |
This part sounds like the issue, but @tlakollo would know for sure. I would expect RAF to work the same as RUC in illink - all overrides have to have a matching annotation status with the slot defining method/implemented interface (so the warning here would be that CodeBase needs to have a RAF attribute and once one does that, the other warnings (at use site) will show up.. |
What Michal described is correct, the Requires attribute matching doesn't go through interfaces nor overrides in the analyzer at this moment, and that's true for both RUC and RAF. dotnet/linker#2046 is the PR that tracks the implementation of this functionality. With this PR we will start producing IL2046 and IL3003 to report attributes not matching with the analyzer. At this moment the PR is halted to solve the diagnostic location for a source implementation with RUC/RAF and missing attributes in a MetadataReference. Once merged we will start to have warnings on the runtime for all of these cases. |
Just checking we are talking about the same thing. There are 2 places where the warning is missing now. Is your PR going to fix both of them ? |
The PR will make https://github.com/dotnet/runtime/blob/main/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs#L77 to warn with the new IL3003 because the override doesn't have the attribute, and once the attribute is there the analyzer will warn with IL3002 in https://github.com/dotnet/runtime/blob/main/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs#L255 because the method is called. The second warning is not part of the fix in the PR, is the already existing analyzer behavior. |
I assume this is now fixed - the analyzer does the required checks and we added necessary annotations into the runtime in the linker->runtime integration PR. |
There are cases like https://github.com/dotnet/runtime/blob/main/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs#L255 where APIs which is not supported in single-file setup are not issuing any warnings when used. What is also strange is that the APIs which are annotated but have override don't need the annotation either, for example, https://github.com/dotnet/runtime/blob/main/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeAssembly.cs#L77
The text was updated successfully, but these errors were encountered: