Skip to content

Conversation

Chriztiaan
Copy link
Collaborator

@Chriztiaan Chriztiaan commented Sep 29, 2025

Description

We originally introduced the MAUI package. The aim was to add extension loading for iOS, Android, and Windows targets. During a recent PoC of the Windows target, I discovered that installing the MAUI package externally (from Nuget via a PackageReference) instead of internally (from the Monorepo via ProjectReference) doesn’t correctly unpack the rust core extension.

Problem/Solutions:

  • Windows MAUI not working at all (incorrectly configured Common .csproj ignore rule).
    • Solution: Fixed the .csproj ignore rules that were excluding the runtimes for the net8.0-windows target.
  • Externally installing PowerSync.Maui targeting iOS not loading the extension on MacOS.
    • Solution: Changed the MAUI to be a binding project, that includes the XCFramework as a NativeReference. You can only currently build iOS binding projects on Mac, updated the workflows accordingly. Also using the correct BundlePath utility.
    • Solution: Added a special runtimeIdentifier when targeting net8.0-ios in our demo.
  • Externally installing PowerSync.Maui and running an Android emulator on Windows resolving the incorrect extension (Linux-x64 instead of x86_64).
    • Solution: Added a build targets file to Common that explicitly removes the Linux extension in favour of the extension from MAUI when building for Android.

Future Work

A lot of these workarounds and issues are caused by PowerSync.Common being responsible for loading the PC platforms. This logic can be simplified if we extract that responsibility to a dedicated package. Common+MAUI for the Android case wouldn't have been affected by the last issue.

@Chriztiaan Chriztiaan force-pushed the fix/maui-extension-loading branch from 88c00ff to ce4d854 Compare September 29, 2025 12:25
Added targets file.

Packing android.

Test.

Test 5.

Test 6.

test 7

test 8

Using bundle path to resolve extension in iOS.
Using a NativeReference to include the xcframework.
Forcing iOS simulator architecture.

Added build step for Maui package.

Fix.

Using mac runner.

Removed clear commands.

Workload restore

Fixed paths for macos runner.

Added props file to Common that ensures we exclude native assets for Android.

Props => targets

Harsher removal of assets for common.

Added comment for ios runtime workaround.
@Chriztiaan Chriztiaan force-pushed the fix/maui-extension-loading branch from ce4d854 to 3f0344c Compare September 29, 2025 12:27
@Chriztiaan Chriztiaan marked this pull request as ready for review September 29, 2025 12:29
Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have much context on the Dotnet ecosystem, but this seems good to me.
I like the idea of separating the Extension loading from the Common core logic in future.

Copy link
Collaborator

@dean-journeyapps dean-journeyapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on both iOS + Mac and Android + Windows. Works well for me!

@Chriztiaan Chriztiaan merged commit fb7e312 into main Oct 2, 2025
1 check passed
@Chriztiaan Chriztiaan deleted the fix/maui-extension-loading branch October 2, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants