Search code examples
iosvisual-studioxamarin.iosassetsxamarin-linker

Xamarin.iOS - Linker behavior: Link All - Assets images removed


Has anyone experienced the images loaded in the Assets Catalog of a Xamarin.iOS project being removed when using the Linker behavior: Link All?

I have the following solution structure (simplified):

  • MyApp.csproj (shared code)
  • MyApp.iOS.csproj (iOS project)
    • Assets

And I compile with the following mtouch arguments:

--linkskip=MyApp --linkskip=MyApp.iOS

Besides the fact of the images not showing up, the rest of the app works flawlessly.

I am using Visual Studio 2022 version 17.2.5; Xamarin version 17.2.0.177

Update:

Interestingly, if I replace the Xamarin.Forms.Image implementations for FFImageLoading.CachedImage, the images are not affected by the LinkAll configuration.


Solution

  • Well, trying to create a reproducible sample I came across the problem.

    Basically, the following line CachedImageRenderer.InitImageSourceHandler(), introduced when using FFImageLoading, was messing up with Xamarin.Forms.Images when the linker was set to LinkAll.

    The documentation of FFImageLoading is not super clear on what this line is for, but removing it fixed the problem.