-
-
Notifications
You must be signed in to change notification settings - Fork 128
Description
I have an iOS project (<TargetFramework>net10.0-ios</TargetFramework>) which, being iOS, automatically compiles with AOT. When I attempt to launch it on an OS X machine in Simulator, it crashes on load and logs the following error message:
Failed to load AOT module 'SQLitePCLRaw.core' while running in aot-only mode because a dependency cannot be found or it is out of date.
SQLitePCLRaw.core is an indirect dependency: the direct dependency is on sqlite-net-pcl version 1.9.172. However, I have a fairly confident guess as to the problem. Given that the error message talks about a dependency of SQLitePCLRaw.core and it only has one dependency, I think the issue is that the AOT compiler is getting confused by System.Memory, and in particular by the fact that the only framework explicitly supported by SQLitePCLRaw.core is one for which the System.Memory package includes a dll.
The obvious fix is to multi-target a netN.0 framework: for preference, to target net10.0 and conditionally also include <IsAotCompatible>true</IsAotCompatible> and address the three instances of
// TODO warning on the following line. SizeOf(Type) replaced in .NET 4.5.1 with SizeOf()
in order to keep the analyser checks for AOT problems happy. I'm happy to create a pull request with these changes if you wish.