-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Extra ILC warnings when PublishAOT=true on method already marked RequiresUnreferencedCode #75898
Comments
@tlakollo Let's work on this as soon as packaging is done and ready for linker in runtime. |
@tlakollo - any update on this? We'd like to get to 0 warnings in a very basic ASP.NET app soon. |
I'll look into this. |
This is a known problem (don't think we have an issue yet) which we've been discussing for a while. In general the NativeAOT compiler's handling of warnings from DAM annotation of generic arguments is problematic. It performs the DAM validation in places where it should not (which is most likely the reason for the extra warnings you see here) and it also reports these warnings as originating from wrong places (doesn't seem to be hit by this code). I've discussed this with @MichalStrehovsky and we need to modify how the compiler handles DAM on generics. The broad idea is:
Unfortunately what this means is that it's not a simple fix and thus will take some time. I guess we (read @vitek-karas 😉) need to prioritize this work. |
I'm hitting this warning now with the code produced by the new project template so it seems this is going to be on the critical path to getting past our stage 1 goals (create a new project from this template with native AOT enabled and get now warnings). |
Any idea how long? Is it something that could make it into 8.0-preview2? That's when we are targeting getting a basic ASP.NET app published for AOT without any warnings. |
I'm hoping to have it done it about a week. I'll know better couple of days in (still lot to learn in the compiler to do this right). |
Just a note that we don't have to fix all of the generic issues in one go. We have known holes around generics (e.g. #80037), so "just" replacing the existing scheme with one that generates warnings from dataflow (that are suppressible) would be a good first step. |
The fix has been reverted due to #81358. |
Reopening as this fix had to be reverted. See #81783 |
Description
When Publishing AOT, I'm seeing extra warnings being emitted that clutter the warnings and confuse developers.
From what I can tell, the warnings are coming from:
runtime/src/libraries/Microsoft.Extensions.Logging.Configuration/src/LoggerProviderConfigurationExtensions.cs
Lines 25 to 29 in 2f3fcca
ServiceDescriptor.Singleton has a [DAM] attribute for the constructor of the 2nd generic arg:
runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/ServiceDescriptor.cs
Line 302 in 2f3fcca
and LoggerProviderConfigureOptions has RDC and RUC on its ctor:
runtime/src/libraries/Microsoft.Extensions.Logging.Configuration/src/LoggerProviderConfigureOptions.cs
Lines 14 to 16 in 2f3fcca
However, these warnings shouldn't be emitted because
RegisterProviderOptions
has RDC and RUC attributes. So I should only be getting the warnings from my call toRegisterProviderOptions
.cc @MichalStrehovsky @vitek-karas
Reproduction Steps
Using 7.0-rc1,
dotnet publish -c Release -r win-x64
the following app:Expected behavior
I should only get warnings for my program's call to
RegisterProviderOptions
.Actual behavior
Along with the expected warnings from my code, I'm getting these extra warnings in the publish output:
Regression?
I'm not sure. Probably not.
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: