-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[MONO][WASM] Fix System.ComponentModel.TypeConverter tests by adding missing ILLink dependencies #50645
Conversation
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @tannergooding, @sbomer Issue DetailsWhen EnableAggressiveTrimming=true, these types get trimmed out, which causes the System.ComponentModel.TypeConverter to fail. This adds the missing assemblies/types to ILLink.Descriptor.xunit.xml, preserving them during the trimming process.
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsWhen EnableAggressiveTrimming=true, these types get trimmed out, which causes the System.ComponentModel.TypeConverter to fail. This adds the missing assemblies/types to ILLink.Descriptor.xunit.xml, preserving them during the trimming process.
|
Is it known why parts of For either reason, I think it is worth noting either in this PR or possibly as a comment above the assembly inclusion in the On another note, maybe it is worth renaming runtime/eng/testing/tests.mobile.targets Line 242 in 8445e4e
|
Adding another ILLink file makes sense; should I do it in this PR, or a follow up? The actual place that ends up needing theses constructors is here (and similar things): https://github.com/castleproject/Core/blob/d88e94447150996973d947a150ffda5efc0c3c1c/src/Castle.Core/DynamicProxy/Tokens/InvocationMethods.cs#L28 This is using reflection, but it guess it is conceivable that some sufficiently smart static analysis could figure that out. How clever is the linker expected to be? |
@naricc I think adding it to this PR would make sense in that in addition to adding But it seems like
I don't know in detail, but I understand there is general issues with reflection. @marek-safar may know better for this situation. |
The sample you noted above https://github.com/castleproject/Core/blob/d88e94447150996973d947a150ffda5efc0c3c1c/src/Castle.Core/DynamicProxy/Tokens/InvocationMethods.cs#L28 is something linker should be able to figure out just fine. You can try setting |
@vitek-karas So I ran it with SuppressTrimAnalysisWarnings=false, and it seems like it is not actually lossing track of it where I thought it was. Here are all the castle related errors: https://gist.github.com/naricc/f3cb83c71bb804bce8548331b62a220c There isn't one involving CompositionInvocation invocation constructor. But I am then unsure why including those assemblies in TrimmerRootDescriptor makes any difference? |
2eb40b9
to
86a878f
Compare
Found the issue - the problem is that Running with ILLink: Trim analysis error IL2067: System.Reflection.NetCoreReflectionExtensions.GetConstructor(Type,BindingFlags,Object,Type[],Object[]): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.NonPublicConstructors' in call to 'System.Reflection.TypeExtensions.GetConstructors(Type,BindingFlags)'. The parameter 'type' of method 'System.Reflection.NetCoreReflectionExtensions.GetConstructor(Type,BindingFlags,Object,Type[],Object[])' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. Which is the root of the problem. The fix in this case would be to annotate the method in Castle, but honestly, Castle has so many other warnings... not sure if this one alone would fix the larger problem. |
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.
LGTM 👍
In a follow up PR (wip in #50885), this will get used in other tests also.
When EnableAggressiveTrimming=true, these types get trimmed out, which causes the System.ComponentModel.TypeConverter to fail. This adds the missing assemblies/types to ILLink.Descriptor.xunit.xml, preserving them during the trimming process, and also introduces a project specific ILLink descriptor.