fuse preview will fail to compile when using `ForeignInclude`

Platform: Windows 10

Fuse version: 0.12.2 (build 6303)

Issue:
The error (unknown): I0000: Failed to compile .NET type 'LaunchApp': The invoked member is not supported before the type is created. will occur when running fuse preview and Uno file contains ForeignInclude. If you comment out ForeignInclude fuse preview will compile without error.

Expected Outcome:
fuse preview compiles and launches

To Recreate:

  1. Install below test app on device
  2. Run fuse preview

Test App:

LaunchApp.uno

using Uno;
using Uno.Collections;
using Fuse;
using Fuse.Triggers.Actions;

using Uno.Compiler.ExportTargetInterop;

[ForeignInclude(Language.Java, "com.fuse.Activity", "android.content.Context", "android.content.Intent", "android.net.Uri", "android.widget.Toast")]
public class LaunchApp : TriggerAction
{

    protected override void Perform(Node target)
    {
        if defined(Android)
        {
            // Do Android/iOS Stuff
            OpenApp();
        } else {
            debug_log("LaunchApp is only for Android");
        }
    }

    [Foreign(Language.Java)]
    public extern(Android) void OpenApp()
    @{
        // Do something here
    @}

}

MainView.ux

<App Theme="Basic">
    <Button Text="Open App">
        <Tapped>
            <LaunchApp />
        </Tapped>
    </Button>
</App>

Hey skezo and thanks for your report!

We’ve been able to reproduce your problem but haven’t figured out what’s wrong yet. It seems to happen only on Windows and not on OSX. As a workaround, you can change the attribute to [extern(Android) ForeignInclude(...)] to make it apply only to Android builds.

I’ve created an internal issue for this.

@Olle

Thanks, the workaround supplied is working for me.