IL Linker and Indirect Dependencies #800
-
Have you ever had issues with indirect dependencies not being included for the IL linker? What tooling decides what goes into For example, I added a Newtonsoft.Json reference, added it in LinkerConfig.xml to exclude it from trimming, but the IL Link logs showed lots of unresolved references for assemblies such as "System.Security.Permissions" that only show up when Newtonsoft is referenced, so I assume it depends on them. When I looked in the Once I went through the IL Link errors, and added direct references to all of the missing assemblies/nuget packages, it built successfully. **I'm wondering how did the IL Linker know these indirect dependencies were needed to the point that it made an attempt to resolve them, but whatever tooling populated the /linker-in/ folder missed them? Or is this problem caused by Newtonsoft nuget package not explicitly declaring these dependencies?** It would be surprising to me if Newtonsoft made such an error, but I notice these are all packages that are the kinds of things that I believe are already part of a typical .NET runtime. You usually wouldn't need to have explicit Nuget package reference for them in the project, because they'll be bound at runtime. I'm making a wild guess that some packages like Newtonsoft don't explicit declare all of their dependencies, if they are things that are already present in a typical .NET runtime install. Meaning there's no need to add actual Nuget package references to the project for them as it'd just generate a bunch of noise for the downstream consuming dev. But in the context of WASM, if Newtonsoft doesn't explicitly declare System.Security.Permissions as a package dependency, then bootstrap doesn't know to include it at build time? Reproduction with binlog if you're interested, but I assume it's not a Bootstrap issue. Just looking more for your insight. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for the report. This is a implicit set of dependencies coming from some .NET packages, and this can be fixed by using the following package: <PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.0" /> as it contains all the dependencies that you've found. |
Beta Was this translation helpful? Give feedback.
Thanks for the report. This is a implicit set of dependencies coming from some .NET packages, and this can be fixed by using the following package:
as it contains all the dependencies that you've found.