admin管理员组文章数量:1122832
I have a WinUI3/WinAppSDK app built with .NET 9. I want to enable Native AOT and Trimming for it but i get a few warnings for the NuGet packages I use.
I have these in my CSProj file. Full version and the source code available here
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>partial</TrimMode>
<SuppressTrimAnalysisWarnings>false</SuppressTrimAnalysisWarnings>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
<ItemGroup>
<TrimmerRootDescriptor Include="MyRoots.xml" />
</ItemGroup>
And I defined assembly names in that XML file such as this
<linker>
<assembly fullname="CommunityToolkit.WinUI.UI.Controls.DataGrid" preserve="all" />
</linker>
But it's not suppressing the warnings or excluding the assemblies from trimming. I used the syntax defined here. I've tried many combinations but none of them seem to work. What am I doing wrong here? How are we supposed to use root descriptors?
Here are some of the warnings but they aren't related to the question. Because I'm looking for a way to use the root descriptors feature for trimming to instruct it not to trim certain assemblies, types and so on according to the official documentation.
ABI.System.Collections.Generic.IDictionary<K,V>.<tor>g__InitFallbackCCWVTableIfNeeded|10_0(): 'KAbi' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in 'ABI.System.Collections.Generic.IDictionaryMethods<K,KAbi,V,VAbi>'. The field 'WinRT.Marshaler<T>.AbiType' 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.
CommunityToolkit.WinUI.Utilities.TypeHelper.GetPropertyOrIndexer(Type, String, Object[]&): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.PublicMethods', 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.PublicNestedTypes', 'DynamicallyAccessedMemberTypes.PublicProperties', 'DynamicallyAccessedMemberTypes.PublicEvents' in call to 'System.Type.GetDefaultMembers()'. The parameter 'type' of method 'CommunityToolkit.WinUI.Utilities.TypeHelper.GetPropertyOrIndexer(Type, String, 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.
Windows.Win32.PInvoke.CoCreateInstance(Guid&, Object, CLSCTX, Guid&, Object&): P/invoke method 'Windows.Win32.PInvoke.CoCreateInstance(Guid*, Object, CLSCTX, Guid*, Object&)' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed.
本文标签: cHow to use root descriptors trimming option in NETStack Overflow
版权声明:本文标题:c# - How to use root descriptors trimming option in .NET? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302942a1931713.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论