I have an application that has an android and ios project with shared code. The android application works perfectly and uses the SDK Only linker. I also have a Linker file to enforce linker not removing used functions - Which is a fairly large file and I've also tried adding a bunch of preserve attributes. The same situation in the iOS project, however, doing the same thing doesn't work. It removes something from EF and throws this exception:
"The type initializer for 'Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions' threw an exception. ---> System.InvalidOperationException"
This whole codebase works perfectly fine without the linking. I've added a bunch of mtouch arguments to try and skip it but that ain't working either.
--linkskip=Microsoft.EntityFrameworkCore
--linkskip=Microsoft.EntityFrameworkCore.Design
--linkskip=Microsoft.EntityFrameworkCore.Sqlite
--linkskip=Microsoft.EntityFrameworkCore.Tools
--linkskip=Interactive.Async
--linkskip=Remotion.Linq
--linkskip=System.Data
--linkskip=System.Collections.Immutable
--linkskip=System.Diagnostics.DiagnosticSource
--linkskip=Microsoft.Extensions.Logging
--linkskip=System.Interactive.Async
--linkskip=Microsoft.EntityFrameworkCore.Abstractions
--linkskip=Microsoft.Extensions.DependencyInjection
--linkskip=Microsoft.Extensions.Caching.Memory
--linkskip=System.ComponentModel.Annotations
I'm about to add every DLL in the NuGet repository which will make the Linker useless. Is this a bug for the iOS Linker or what am I missing here? I've read the documentation https://learn.microsoft.com/en-us/xamarin/ios/deploy-test/linker?tabs=windows and searched everywhere on the internet and nothing comes up. Any help is appreciated.
Thanks,