Accessing Guide throws TypeInitalizationException

Hi all,

porting an old XNA WP7 game to WP8.1+ using mono with intent to bring to iOS and droid later on. Finally got most of the kinks out but it seems whenever I try to access Guide I get a TypeInitalizationException.

For example Guide.IsTrialMode and Guide.BeginShowKeyboardInput both throw it.

The monogame I downloaded didnt have gamerservices included in my new project by default for some reason so I had to add the Monogame.Framework.Net library reference myself to get access, I pulled it from MonoGame/v3.0/Assemblies/WindowsPhone81/ folder. I have not been able to find any information saying I should manually initialise it myself.

Any idea whats up? Thanks :slight_smile:

The problem seems specific to the fact my actual hardware is running windows phone 10. The inner exception from the TypeInitializationException is:

System.Exception: Exception from HRESULT: 0x803F6107
at Windows.ApplicationModel.Store.CurrentApp.get_LicenseInformation()
at Microsoft.Xna.Framework.GamerServices.Guide…cctor()

which seems relevant to:

indeed, my app works as expected in a wp8.1 emulator but crashes on my 10 device. I find this REALLY odd though because my original WP7 game written in XNA uses the same Guide lib, is downloadable from app store on my wp10 device and works fine testing trial mode and presenting the OS keyboard… and its OLD.

I guess I have to detect which phone OS is being ran and manually open keyboard/check trial mode in some way appropriate to the platform? It would be awesome if future monogame automatically detected and looked after this, it always used to be build once work on all XD (…and as i say still is for old wp7 game…)

The licensing API behind the scenes is very different in Windows Phone 7 than Windows Phone 10. There has no been a lot of attention given to Windows Phone 10 as the developer base is still very small. This is a bug that will need someone to look at it.

is it possible this is a development only issue? We know win10 phones support 7/8.1 apps which is why I’m targetting 8. Some tomjiggery must be done when wp10 is installing an app it knows is 8.1 from store which isn’t done when side load deploying from visual studio over usb… I assume if I compiled and released officially to store it would “just work ™”

I wonder what quickest way to solve this is.

Okay so here is a thing. rather than roll my own input solutions etc per-platform I decided I would at least have a go at pulling the mg source from github and seeing if i could fix it. I’m not great with other peoples code so bare with but I’ve ran into something a little odd.

I am targetting wp8.1 and stepping through my errors in Guide.cs I notice the constant WINDOWS_PHONE is NOT defined. I figured there must be a WINDOWS_PHONE81 const or something but there appears not to be. Further more in the constructor for Guide the code block for:


executes. The initialization error then gets thrown by the line:

var licenseInformation = CurrentApp.LicenseInformation;

which is not overly surprising as this is neither a windows store (i assume that means desktop app store) nor UAP application. Am I missing something fundamental or are these platform constants a little awry?

This is still an issue in windows universal apps. Crashes just the same

1 Like

This is still an issue.