IAP throws exception on WP8

Hi,

I’m trying to add IAP to the Window Phone version of my game, but I keep getting an exception when trying to get the licence information for my app while in-game.

I’m calling “CurrentApp.LicenseInformation.ProductLicenses.TryGetValue(productId, out licence);” to get the licence info.

The exception I get is:
“WinRT information: The application called an interface that was marshalled for a different thread.”

This call works fine when I call it at the start of my GamePage constructor in GamePage.xaml.cs.

Can anyone shed any light on why this is happening?

Thanks!

Hello Ben_P1,

I think you must call that function on UI thread.

Any links and/or advice on how to do this? At the risk of sounding ignorant, I’m not aware of how the threading in a monogame game works…

Thanks!

this should work: