Xamarin/MonoTouch: Unable to compile in “Link SDK only” mode due to missing symbols

前端 未结 1 647
一向
一向 2021-01-18 07:00

I am trying to compile my iOS application using MonoTouch in Link SDK only mode. It compiles completely fine if I turn off linking entirely but it also produces a colossal b

相关标签:
1条回答
  • 2021-01-18 07:52

    The main issue is that it is not possible to do code generation at runtime on iOS.

    That means that a large part of System.Linq.Expressions would, normally, be impossible to provide under normal circumstances (just like System.Refection.Emit can't be provided).

    To workaround this Xamarin.iOS has been providing an alternative implementation (that can interpret the most common expressions).

    However the current code is not 100% API compatible with the .NET framework (that's fixed but not yet released). E.g.

    System.Linq.Expressions.Expression System.Linq.Expressions.ExpressionVisitor::Visit(System.Linq.Expressions.Expression)

    The above returns void in the current Xamarin.iOS (7.0.x) releases. That why the linker complains (it's not a bug) as it cannot find this member reference (and if it can't find it it cannot recreate the smaller, linked, assemblies). It is not possible to preserve a member that does not exist (which is why your attempts to use XML files or attributes won't help).

    The current workaround is to identify which of your assemblies is using this API and rebuild it (from source) to use the existing System.Core.dll that is shipped with Xamarin.iOS.

    Notes

    I can't figure out how to instruct the linker to not strip it out.

    The linker does not try to strip it out it tries to keep it in (i.e. it must load the reference to be able to save it back). However it cannot find that member in System.Core.dll making it impossible to provide a valid linked version of the assemblies.

    <method signature="System.Linq.Expressions.Expression Visit(System.Linq.Expressions.Expression)" />
    

    That's asking to preserve something that does not exist. It will be ignored, i.e. when the void-returning version is found it will not match the XML description.

    0 讨论(0)
提交回复
热议问题