This project is read-only.

VS2012 Template

Topics: Windows Phone 8
Dec 16, 2013 at 10:14 PM
Is the template available via Visual Studio online extensions meant to run out of the box?

Installed it today on VS2012 to try out the Cocos2d-XNA framework. I builds fine but doesn't appear to deploy properly on my Lumia 920 device. The following debug message, repeated twice, is the only thing pointing to a problem:

An exception of type 'System.TypeLoadException' occurred in Unknown Module. and wasn't handled before a managed/native boundary

Debug or Release mode doesn't make a difference. Also unable to compile for x86/emulator, only ARM/device.
Dec 17, 2013 at 4:03 AM
I've never seen this exception with the WP8 template. The templates did all work when they were pushed to the vsix gallery. We are working on updating them.
Dec 17, 2013 at 5:38 AM
You are building your own vsix template installer and that installer is throwing the type load exception. The type being loaded is:
                    Device = new XAudio2(XAudio2Flags.None, ProcessorSpecifier.DefaultProcessor);
This occurs in MonoGame, SoundEffect.cs.

This could be just a bad nugget package for MonoGame.
Dec 17, 2013 at 5:45 AM
hahaha.

the SharpDX libraries are not included in the project produced by the vsix project for wp8. You need to include those to make monogame work on wp8. Working on that now.
Dec 17, 2013 at 9:02 AM
Ok, tried including SharpDX (by adding references, anything else I need to do?). Now the TypeLoad exception doesn't show, instead it just hangs on "Loading..." on the device.
Dec 17, 2013 at 4:16 PM
The hang on Loading ... is a dead lock on running the sound control on the media element's dispatcher. I think the nuget version has a bad monogame build. If you pause the debugger you will see that it is waiting on a lock started inside of MonoGame when we are getting the playback position from the media element. This was fixed in our fork of MonoGame. We probably need to update and sych the stable branch with master.
Dec 17, 2013 at 4:48 PM
Ah yes, you're correct. I'll await a fix then.

Can you please tell me about debugging on the emulators, is that working with cc2d XNA? I was unsuccessful, VS kept complaining about it being an ARM build eventhough I switched the configuration manager to win32 and rebuilt the whole project.
Dec 17, 2013 at 5:56 PM
I updated all of the vsix and nuget build scripts and updated the release files of the vsix templates on github. In the 'vsix' directory from the root you will find the installers for each platform and they have been updated with Cocos2D-XNA 1.3, which is the current master and our current monogame fork.

These should work. Let me know if you have problems with these too.
Dec 17, 2013 at 5:57 PM
Debugging works great, we do it all of the time. Make sure you build with x86 and for the emulator target.
Dec 17, 2013 at 6:28 PM
I managed to get it running on the emulator. This works and the "Hello Cocos2d-XNA" message is being displayed. On my Lumia, however, still no go. Looking at the call stack it hangs on exactly the same spot as before - MediaPlayer.PlayPosition.get()
Dec 18, 2013 at 4:01 AM
Add the following to the ctor of your AppDelegate class:
        HandleMediaStateAutomatically = false;
that will fix this problem. MonoGame fires off the app started events prematurely on WP8 and Windows 8 Xaml which leaves the simple audio engine stuck in a dead wait state because it is waiting on a lock that never gets triggered again.

I will have this fixed in 1.3 which will go up to the stable branch next week.
Dec 18, 2013 at 6:51 AM
Sorry but "The name 'HandleMediaStateAutomatically' does not exist in the current context". I must have an outdated CCApplication version here. I can wait until next week, no rush.
Dec 19, 2013 at 1:09 AM
You can also get the latest vsix here:

https://github.com/Cocos2DXNA/cocos2d-xna/tree/master/vsix
Dec 31, 2013 at 7:45 PM
Version 1.3.0.2 has been released to our nuget repository. The VSIX extension templates have also been updated. You will find them in our cocos2d-xna developer account. Kenneth put them up on his account back in June and we decided to move the templates over to the cocos2dxna account this time.

The release date on the official extensions is 12/29/2013.
Jan 5, 2014 at 7:36 AM
Thanks, I'll give it a spin shortly