Skip to content
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

Multiple IL2049 warnings when publishing with NativeAOT and _AggressiveAttributeTrimming #88994

Closed
Sergio0694 opened this issue Jul 17, 2023 · 5 comments · Fixed by #91782
Closed

Comments

@Sergio0694
Copy link
Contributor

Sergio0694 commented Jul 17, 2023

Description

I tried using _AggressiveAttributeTrimming to check the size diffs, and noticed a whole bunch of warnings:

resource ILLink.LinkAttributes.xml in System.Private.CoreLib(377,8): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes. [C:\Users\sergiopedri\git\ComputeSharp\samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj]

Reproduction Steps

$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -c Release -f net8.0 -r win-x64

Expected behavior

Should build with no warnings.

Actual behavior

When _AggressiveAttributeTrimming is set, you get a whole bunch of warnings.

Configuration

  • 8.0.100-preview.7.23364.32
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 17, 2023
@ghost
Copy link

ghost commented Jul 17, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

I tried using _AggressiveAttributeTrimming to check the size diffs, and noticed a whole bunch of warnings:

resource ILLink.LinkAttributes.xml in System.Private.CoreLib(377,8): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes. [C:\Users\sergiopedri\git\ComputeSharp\samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj]

Reproduction Steps

$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -c Release -f net8.0 -r win-x64

Expected behavior

Should build with no warnings.

Actual behavior

When _AggressiveAttributeTrimming is set, you get a whole bunch of warnings.

Regression?

No response

Known Workarounds

No response

Configuration

  • 8.0.100-preview.7.23364.32

Other information

No response

Author: Sergio0694
Assignees: -
Labels:

untriaged, area-NativeAOT-coreclr

Milestone: -

@MichalStrehovsky
Copy link
Member

It's generating a warning because an obscure/useless corner case of the attribute trimming XML format is not implemented. Can be fixed by just not generating the warning (it's unlikely the obscure corner case is worth the effort to implement).

Since _AggressiveAttributeTrimming (or the XML format) is not documented, moving this to Future, pending result of #88805.

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 19, 2023
@rolfbjarne
Copy link
Member

This affects NativeAOT when targeting Apple platforms (net8.0-macos/maccatalyst/ios/tvos):

	resource ILLink.LinkAttributes.xml in System.Private.CoreLib(335): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes.
	resource ILLink.LinkAttributes.xml in System.Private.CoreLib(342): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes.
	resource ILLink.LinkAttributes.xml in System.Private.CoreLib(349): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes.
	resource ILLink.LinkAttributes.xml in System.Private.CoreLib(356): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes.
	resource ILLink.LinkAttributes.xml in System.Private.CoreLib(363): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes.
	resource ILLink.LinkAttributes.xml in System.Private.CoreLib(370): warning IL2049: System.Private.CoreLib: The internal attribute name 'RemoveAttributeInstances' being used in the xml is not supported by ILLink, check the spelling and the supported internal attributes.

MichalStrehovsky added a commit that referenced this issue Sep 8, 2023
Fixes #88994.

ILLinker attribute XML format has a way to express "only remove these attributes when parameter X has value of Y". We currently generate a warning and don't trim the attribute at all.

The savings from trimming these attributes are going to be miniscule. Even in IL, this is scraping the bottom of the barrel. In Native AOT these attributes are pretty effectively deduplicated across assemblies. We'll likely never need this.

This keeps the existing behavior (don't trim the attribute), but removes the warning.
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Sep 8, 2023
@MichalStrehovsky
Copy link
Member

This affects NativeAOT when targeting Apple platforms (net8.0-macos/maccatalyst/ios/tvos):

Does this show up in customer scenarios? (Would we want this for 8.0?)

@ivanpovazan
Copy link
Member

This affects NativeAOT when targeting Apple platforms (net8.0-macos/maccatalyst/ios/tvos):

Does this show up in customer scenarios? (Would we want this for 8.0?)

Sorry for the late reply. Yes these show up in template apps, I have posted examples of warnings here:
xamarin/xamarin-macios#18571 (comment)
We would like to have dotnet new ios app have 0 warnings for .NET8.

PS I see you have already opened a PR for this, thanks!

MichalStrehovsky added a commit that referenced this issue Sep 11, 2023
Fixes #88994.

ILLinker attribute XML format has a way to express "only remove these attributes when parameter X has value of Y". We currently generate a warning and don't trim the attribute at all.

The savings from trimming these attributes are going to be miniscule. Even in IL, this is scraping the bottom of the barrel. In Native AOT these attributes are pretty effectively deduplicated across assemblies. We'll likely never need this.

This keeps the existing behavior (don't trim the attribute), but removes the warning.
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 11, 2023
github-actions bot pushed a commit that referenced this issue Sep 11, 2023
Fixes #88994.

ILLinker attribute XML format has a way to express "only remove these attributes when parameter X has value of Y". We currently generate a warning and don't trim the attribute at all.

The savings from trimming these attributes are going to be miniscule. Even in IL, this is scraping the bottom of the barrel. In Native AOT these attributes are pretty effectively deduplicated across assemblies. We'll likely never need this.

This keeps the existing behavior (don't trim the attribute), but removes the warning.
carlossanlop pushed a commit that referenced this issue Sep 12, 2023
Fixes #88994.

ILLinker attribute XML format has a way to express "only remove these attributes when parameter X has value of Y". We currently generate a warning and don't trim the attribute at all.

The savings from trimming these attributes are going to be miniscule. Even in IL, this is scraping the bottom of the barrel. In Native AOT these attributes are pretty effectively deduplicated across assemblies. We'll likely never need this.

This keeps the existing behavior (don't trim the attribute), but removes the warning.

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
@dotnet dotnet locked as resolved and limited conversation to collaborators Oct 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants