Reactive Extensions for .NET in an iOS share extension

Written by zbrianw | Published 2017/10/20
Tech Story Tags: ios | xamarin | rx | dotnet | reactive-extension

TLDRvia the TL;DR App

One of the applications we’re building makes use of Reactive Extensions for .NET in an iOS share extension.

We had encountered the share extension closing when being run on a real device rather than it working as it did when run via the iOS simulator. The error was: “error: Failed to load AOT module ‘/private/var/containers/Bundle/Application/{id}/{app}/System.Reactive.PlatformServices.dll.so’ in aot-only mode.”

The first step was to diagnose if the linker was removing the reference, so I tried setting the Linker Behavior to “Don’t Link” in the share extension project and in the container application project. Clean and rebuild. The same error occurred.

After much fiddling, the accidental discovery that by adding: System.Reactive.PlatformServices.EnlightenmentProvider.EnsureLoaded(); allowed the share extension to load and run on the actual device. The summary describes it best:

EnlightmentProvider [from metadata]

Thought I would put the notes up somewhere for the next time I search for “System.Reactive.PlatformServices.dll.so’ in aot-only mode.” which I didn’t have much luck with this past week ;)


Published by HackerNoon on 2017/10/20