简体   繁体   中英

For a xamarin.iOS app, how to identify assembly that a symbol comes from

When I build an archive for my Xamarin Forms iOS app, the linker is eliminating some required symbols for Firebase. A build work fine. I know that is can use --linkskip to keep an assembly but how do you identify which assembly needs to be specified to preserve the symbol.

This is helpful if using [Preserve] on some assemblies is impossible (eg 3rd party code) or as a temporary workaround for a bug.

You can have a look at Skipping Assemblies , when which assembly is not used or occurs a bug with which assembly , you can identify it .

I found the Object Browser extremely helpful for that purpose. If you set the browse scope to "My Solution" it'll show you all classes that are defined in and referenced from your current solution. From thereon you can search for the classes that are missing during runtime (searching may take some seconds, depending on your solutions size). Select the respective class and delete the search text. The selected class remains selected and you can see the container (ie assembly) the class is defined in and add it to linkskip.

On a side note: When your project grows there may be many exceptions for the linker to add. While it may be possible to add all of these with linkskip, a linker XML definition may be more feasible. To use this, add an XML file with the build target LinkDescription . Within that file add the assemblies and types to preserve

<linker>
  <assembly fullname="Firebase.XXX">
    <type fullname="*" /> <-- Preserve everything from that assembly -->
  </assembly>
</linker>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM