You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Sergio0694 and I found that the following trim warnings are emitted by a default WinUI 3 project (built with "trimmer-safe" CsWinRT projections):
1>ILLink : Trim analysis warning IL2026: WinRT.Projections..cctor(): Using member 'System.MulticastDelegate.MulticastDelegate(Object, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The target method might be removed.
1>ILLink : Trim analysis warning IL2026: WinRT.Projections..cctor(): Using member 'System.Delegate.Delegate(Object, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The target method might be removed.
1>ILLink : Trim analysis warning IL2026: WinRT.Projections..cctor(): Using member 'System.Delegate.CreateDelegate(Type, Object, String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The target method might be removed.
1>ILLink : Trim analysis warning IL2026: WinRT.Projections..cctor(): Using member 'System.Delegate.CreateDelegate(Type, Object, String, Boolean, Boolean)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The target method might be removed.
1>ILLink : Trim analysis warning IL2026: WinRT.Projections..cctor(): Using member 'System.Delegate.CreateDelegate(Type, Object, String, Boolean)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The target method might be removed.
These warnings are emitted because Projections.RegisterCustomAbiTypeMappingNoLock has DynamicallyAccessedMembers(PublicMethods) on the type parameter, and a delegate type typeof(EventHandler<>) is passed in. As a result, the trimmer warns about these methods with RequiresUnreferencedCodeAttribute since it can't be sure you don't access these methods through reflection. These warnings aren't emitted by the trimmer analyzer due to dotnet/linker#3111.
These warnings should be suppressed because these methods are never invoked via reflection based on the usage.
Describe the bug
@Sergio0694 and I found that the following trim warnings are emitted by a default WinUI 3 project (built with "trimmer-safe" CsWinRT projections):
These warnings are emitted because
Projections.RegisterCustomAbiTypeMappingNoLock
hasDynamicallyAccessedMembers(PublicMethods)
on the type parameter, and a delegate typetypeof(EventHandler<>)
is passed in. As a result, the trimmer warns about these methods withRequiresUnreferencedCodeAttribute
since it can't be sure you don't access these methods through reflection. These warnings aren't emitted by the trimmer analyzer due to dotnet/linker#3111.These warnings should be suppressed because these methods are never invoked via reflection based on the usage.
To Reproduce
<PublishTrimmed>true</PublishTrimmed>
Expected behavior
No trimmer warnings from WinRT.Runtime.dll
Version Info
VS2022.4
Additional context
@Sergio0694 has a repro.
The text was updated successfully, but these errors were encountered: