I am trying to create the mainboard object for FEZ Cream in a headless IoT app (no UI), but I’m getting a marshalling error.
public sealed class StartupTask : IBackgroundTask
{
private BackgroundTaskDeferral Deferral;
private FEZCream Mainboard;
public void Run(IBackgroundTaskInstance taskInstance)
{
Deferral = taskInstance.GetDeferral();
Setup();
while (true) { }
}
private async void Setup()
{
try
{
Mainboard = await Module.CreateAsync<FEZCream>();
...
}
System.Exception: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))
at Windows.UI.Xaml.DispatcherTimer…ctor()
Is the FEZCream code not compatible with a headless app? I can go back and make it a UWP app with UI, but I plan on not having a display connected so it seemed a non-UI IoT project would be the right choice.