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

Annotate remaining runtime libraries for NativeAOT #75480

Open
LakshanF opened this issue Sep 12, 2022 · 8 comments
Open

Annotate remaining runtime libraries for NativeAOT #75480

LakshanF opened this issue Sep 12, 2022 · 8 comments

Comments

@LakshanF
Copy link
Contributor

LakshanF commented Sep 12, 2022

The below set of runtime assemblies need to be annotated for AOT (the # of warnings might not be accurate and need to be validated). Related issues - #69739, #61231, #67741

Assembly Aot Warnings
System.Linq.Expressions.dll 124
System.Private.Xml.dll 78
System.Xml.XmlSerializer.dll 39
System.Xml.XmlDocument.dll 39
System.Xml.XPath.dll 39
System.Xml.XPath.XDocument.dll 39
System.Private.Xml.Linq.dll 39
System.Xml.ReaderWriter.dll 39
System.Xml.XDocument.dll 39
Microsoft.CSharp.dll 20
System.ComponentModel.Composition ?
System.Composition.Hosting ?
System.Composition.Runtime ?
System.Composition.TypedParts ?
System.Configuration.ConfigurationManager ?
System.Data.Odbc ?
System.Data.OleDb ?
System.DirectoryServices ?
System.DirectoryServices.AccountManagement ?
System.DirectoryServices.Protocols ?
System.Drawing.Common ?
System.Reflection.Context ?
System.Reflection.MetadataLoadContext ?
System.Resources.Extensions ?
System.Runtime.InteropServices.JavaScript ?
System.Runtime.Serialization.Schema ?
System.ServiceModel.Syndication ?
System.Windows.Extensions ?
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 12, 2022
@ghost
Copy link

ghost commented Sep 12, 2022

Tagging subscribers to this area: @dotnet/area-system-xml
See info in area-owners.md if you want to be subscribed.

Issue Details

The below set of runtime assemblies need to be annotated for AOT (the # of warnings might not be accurate and need to be validated). Related issues - #69739, #61231, #67741

Assembly Aot Warnings
System.Linq.Expressions.dll 124
System.Private.Xml.dll 78
System.Xml.XmlSerializer.dll 39
System.Xml.XmlDocument.dll 39
System.Xml.XPath.dll 39
System.Xml.XPath.XDocument.dll 39
System.Private.Xml.Linq.dll 39
System.Xml.ReaderWriter.dll 39
System.Xml.XDocument.dll 39
Microsoft.CSharp.dll 20
System.Net.Http.dll 1
Author: LakshanF
Assignees: -
Labels:

area-System.Xml, untriaged

Milestone: -

@LakshanF LakshanF added this to the 8.0.0 milestone Sep 12, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Sep 12, 2022
@danmoseley
Copy link
Member

our systems expect exactly 1 area label -- I'm assuming you're doing it @LakshanF so leaving area-nativeaot-coreclr.

@JamesNK
Copy link
Member

JamesNK commented Jan 10, 2023

System.Linq.Expressions warnings appear when publishing an empty ASP.NET Core app.

@jkotas
Copy link
Member

jkotas commented Jan 10, 2023

What's the warning? Should System.Linq.Expressions be trimmed out from ASP.NET Core apps in .NET 8 instead?

@JamesNK
Copy link
Member

JamesNK commented Jan 10, 2023

What's the warning?

/_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ArrayOperations.cs(23): AOT analysis warning IL3050: System.Linq.Expressions.Interpreter.NewArrayInitInstruction.Run(InterpretedFrame): Using member 'System.Array.CreateInstance(Type,Int32)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available. [C:\DotNetTest\AspNetTest\AspNetTest.csproj]
/_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ArrayOperations.cs(52): AOT analysis warning IL3050: System.Linq.Expressions.Interpreter.NewArrayInstruction.Run(InterpretedFrame): Using member 'System.Array.CreateInstance(Type,Int32)' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available. [C:\DotNetTest\AspNetTest\AspNetTest.csproj]
/_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/ArrayOperations.cs(87): AOT analysis warning IL3050: System.Linq.Expressions.Interpreter.NewArrayBoundsInstruction.Run(InterpretedFrame): Using member 'System.Array.CreateInstance(Type,Int32[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available. [C:\DotNetTest\AspNetTest\AspNetTest.csproj]
/_/src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs(28): AOT analysis warning IL3050: System.Dynamic.Utils.TypeUtils.GetNullableType(Type): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime. [C:\DotNetTest\AspNetTest\AspNetTest.csproj]
/_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs(1379): AOT analysis warning IL3050: System.Linq.Expressions.Expression.ApplyTypeArgs(MethodInfo,Type[]): Using member 'System.Reflection.MethodInfo.MakeGenericMethod(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime. [C:\DotNetTest\AspNetTest\AspNetTest.csproj]
/_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(2239): AOT analysis warning IL3050: System.Linq.Expressions.Expression.GetResultTypeOfShift(Type,Type): Using member 'System.Type.MakeGenericType(Type[])' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The native code for this instantiation might not be available at runtime. [C:\DotNetTest\AspNetTest\AspNetTest.csproj]

Should System.Linq.Expressions be trimmed out from ASP.NET Core apps in .NET 8 instead?

I think that is a goal. There are some places where System.Linq.Expressions is coupled to important code. I'll investigate more whether there are ways to completely remove any code that touches on it.

@eerhardt
Copy link
Member

Should System.Linq.Expressions be trimmed out from ASP.NET Core apps in .NET 8 instead?

Yes, my intention is that Linq.Expressions won't be used in basic ASP.NET Core app in .NET 8. From my previous investigations, it adds ~1MB to the app size.

With dotnet/aspnetcore#46020 (comment) we have eliminated it from the core logic. And saved 1.3 MB.

eerhardt added a commit that referenced this issue Feb 6, 2023
* EnableAotAnalyzer by default for src libraries

This flips the default of EnableAotAnalyzer to true so all new libraries are analyzed by default. It also allows us to easily see which libraries haven't been annotated yet.

I also fixed the warnings in 2 libraries that were really quick: System.Memory.Data and System.ComponentModel.TypeConverter.

Contributes to #75480
eerhardt added a commit to eerhardt/runtime that referenced this issue Feb 7, 2023
jkotas pushed a commit that referenced this issue Feb 7, 2023
* EnableAotAnalyzer for System.Diagnostics.EventLog

Contributes to #75480

* EnableAotAnalyzer for System.Diagnostics.PerformanceCounters

* Avoid boxing T.
ViktorHofer pushed a commit to dotnet/winforms that referenced this issue Feb 13, 2023
* EnableAotAnalyzer by default for src libraries

This flips the default of EnableAotAnalyzer to true so all new libraries are analyzed by default. It also allows us to easily see which libraries haven't been annotated yet.

I also fixed the warnings in 2 libraries that were really quick: System.Memory.Data and System.ComponentModel.TypeConverter.

Contributes to dotnet/runtime#75480

Commit migrated from dotnet/runtime@ea7e1c7
@agocke agocke added this to AppModel Apr 3, 2023
@LakshanF
Copy link
Contributor Author

This should be done now.

@eerhardt
Copy link
Member

eerhardt commented Aug 1, 2023

This is not done. We still disable the AOT analyzer in the following projects:

<EnableAOTAnalyzer>false</EnableAOTAnalyzer>

<EnableAOTAnalyzer>false</EnableAOTAnalyzer>

<EnableAOTAnalyzer>false</EnableAOTAnalyzer>

We need to annotate those libraries for NativeAOT and enable the analyzer.

<EnableAOTAnalyzer>false</EnableAOTAnalyzer>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

7 participants