Skip to content

AOT crash in iOS because of dependency #659

@pjt33

Description

@pjt33

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions