-
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
[wasm] Fix trimming errors for library tests, to help building with AOT #50885
Conversation
Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer Issue Details
|
d01b28b
to
8b18e5c
Compare
f011bfb
to
837548a
Compare
46e4653
to
3b817b1
Compare
@@ -0,0 +1,13 @@ | |||
<linker> |
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.
All these files should have Descriptors
in the name following the naming pattern set by the linker.
See the docs here:
https://github.com/mono/linker/blob/55bd0ebd00ddbf2cd817314b1cf6824003cfb463/docs/data-formats.md#descriptor-format
@@ -0,0 +1,10 @@ | |||
<linker> | |||
<assembly fullname="System.Private.DataContractSerialization"> | |||
<type fullname="System.Runtime.Serialization.KeyValue`2" /> |
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.
cc @joperezr - is your change going to make it so this is no longer necessary?
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.
In general, I don't think we should be adding ILLink.Descriptors
files for our own assemblies. Instead we should be fixing our assemblies to be trimmable.
<type fullname="System.Runtime.Serialization.KeyValuePairAdapter`2" /> | ||
</assembly> | ||
<assembly fullname="System.Private.Xml.Linq"> | ||
<type fullname="System.Xml.Linq.XElement" /> |
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.
Why is this necessary? It shouldn't be.
<linker> | ||
<assembly fullname="System.Data.Common"> | ||
<type fullname="System.Data.DataColumn"> | ||
<method signature="System.Void .ctor()" /> |
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.
cc @krwq - is your change going to fix this?
@@ -0,0 +1,7 @@ | |||
<linker> | |||
<assembly fullname="System.Private.CoreLib"> | |||
<type fullname="System.Collections.ArrayList" /> |
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.
Why is this necessary? It shouldn't be.
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.
I was seeing this as:
02:19:20] fail: [FAIL] System.Reflection.Tests.TypeInfoTests.IsAssignable(type: typeof(System.Collections.IList), c: typeof(System.Collections.ArrayList), expected: True)
[02:19:20] info: Assert.Equal() Failure
[02:19:20] info: Expected: True
[02:19:20] info: Actual: False
[02:19:20] info: at System.Reflection.Tests.TypeInfoTests.IsAssignable(Type type, Type c, Boolean expected)
[02:19:20] info: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
This PR is an attempt to remove the trimming errors, to enable AOT tests to be built. I didn't delve into why the linker wasn't being able to pick up the usage. We could look into that, when I make a clean PR based on main
.
<linker> | ||
<assembly fullname="System.Diagnostics.TraceSource"> | ||
<type fullname="System.Diagnostics.TraceListener"> | ||
<method signature="System.Void .ctor()" /> |
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.
Do you know why this is necessary? It shouldn't be.
868d149
to
4ab2f77
Compare
EnableAggressiveTrimming
, for building AOT tests
#51249
4ab2f77
to
a359117
Compare
d0e003a
to
10a6ba1
Compare
@@ -0,0 +1,7 @@ | |||
<linker> | |||
<assembly fullname="System.Diagnostics.TraceSource"> |
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.
This one is a bit unexpected, do you know where is it used?
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.
Agreed - this shouldn't be necessary because all the ILLink warnings are fixed in this assembly. This might be a product bug somewhere.
@@ -0,0 +1,3 @@ | |||
<linker> | |||
<assembly fullname="mscorlib" /> |
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.
Is this still necessary with the latest linker? We had a few fixes that went in to preserve facade assemblies.
@@ -14,5 +14,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\TestExe\System.Reflection.TestExe.csproj" /> | |||
|
|||
<TrimmerRootDescriptor Include="$(MSBuildThisFileDirectory)..\ILLink.Descriptors.CoreCLR.xml" /> |
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.
Can this ILLink.Descriptors.CoreCLR.xml
file move next to the .csproj that needs it?
@@ -6,6 +6,7 @@ | |||
<TestDependsOn Condition="'$(TestNoBuild)' != 'true' and '$(BuildAllProjects)' != 'true'">Build</TestDependsOn> | |||
<TestDependsOn>$(TestDependsOn);GenerateRunScript;RunTests</TestDependsOn> | |||
<VSTestNoLogo>true</VSTestNoLogo> | |||
<ILDescriptorsPath>$(MSBuildThisFileDirectory)ildescriptors\</ILDescriptorsPath> |
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.
This needs a better name. How about?
<ILLinkDescriptorsPath>$(MSBuildThisFileDirectory)ILLinkDescriptors\</ILLinkDescriptorsPath>
@@ -0,0 +1,10 @@ | |||
<linker> | |||
<assembly fullname="System.Private.DataContractSerialization"> | |||
<type fullname="System.Runtime.Serialization.KeyValue`2" /> |
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.
Are these still necessary on the latest main? @joperezr addressed the ILLink warnings in this assembly, so these might be fixed.
If they aren't fixed, we should open a bug to make sure we don't have a product bug here.
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.
DCS is annotated now but most of it was annotated as unsafe. It would be good to understand who actually needs this so that we can check why is the type not being preserved and to find out if it is expected or not
@@ -0,0 +1,7 @@ | |||
<linker> | |||
<assembly fullname="System.Private.CoreLib"> | |||
<type fullname="System.Collections.ArrayList" /> |
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.
This is suprising. Why is this necessary?
<linker> | ||
<assembly fullname="System.Data.Common"> | ||
<type fullname="System.Data.DataColumn"> | ||
<method signature="System.Void .ctor()" /> |
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.
fyi @krwq again here
@eerhardt This PR was based on another big PR which got merged last night. And I had been working on this over the last few weeks. So, it's definitely possible that some of the changes aren't needed anymore, as you suggested. I'm going to enable all the tests on separate temporary PR, and then apply the fixes that are still useful, and we can have the current error messages etc. Then I can reset the history here. |
I think it'd be better to enable trimming analyzer warnings for this than trying to guess where stuff can break. We could exclude the 3rd party libs to make it less noisy. |
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer Issue Details
|
For our test assemblies? I'm unsure if that would be worth the effort. |
Why? Isn't that what this and probably more upcoming PRs will do? |
|
Once this PR goes it that will be the case, every PR touching libraries will have to ensure the tests are not failing with the linker running for the browser's test |
It's already enabled on |
I have re-tested, and applied all the relevant changes with clean commits in #51697 . Some changes weren't needed with the latest Closing this in favor of that PR. |
No description provided.