Trying to run the Angry Ninjas sample but it crashes

Topics: iOS
Feb 12, 2014 at 7:23 PM
Hi,

I'm trying to dig into Cocos2D XNA and thought the Angry Ninjas example would be a good place to start. I am trying to build it for the iPhone. However, it crashes immediately. I have pasted the trace below. Can anybody make sense from this crash?

System.TypeInitializationException: An exception was thrown by the type initializer for Microsoft.Xna.Framework.Graphics.GraphicsDevice

2014-02-12 21:15:36.343 AngryNinjas[16115:60b] Unhandled managed exception: An exception was thrown by the type initializer for Microsoft.Xna.Framework.Graphics.GraphicsDevice (System.TypeInitializationException)
at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00081] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\GraphicsDeviceManager.cs:380
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00001] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\GraphicsDeviceManager.cs:124
at Microsoft.Xna.Framework.GamePlatform.BeforeInitialize () [0x0003f] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\GamePlatform.cs:268
at Microsoft.Xna.Framework.iOSGamePlatform.BeforeInitialize () [0x00001] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\iOS\iOSGamePlatform.cs:188
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00008] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\Game.cs:739
at Microsoft.Xna.Framework.Game.Run (G
ameRunBehavior runBehavior) [0x00027] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\Game.cs:466
at Microsoft.Xna.Framework.Game.Run () [0x00001] in c:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\Game.cs:456
at AngryNinjas.Program.FinishedLaunching (MonoTouch.UIKit.UIApplication app) [0x0000c] in c:\Users\rene\Source\Repos\AngryNinjas\AngryNinjas\Program.cs:36
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pmcs-compat.UIApplication.cs:38
at AngryNinjas.Program.Main (System.String[] args) [0x00001] in c:\Users\rene\Source\Repos\AngryNinjas\AngryNinjas\Program.cs:44
Debugging session ended.
Coordinator
Feb 12, 2014 at 8:30 PM
The best place to start is with the sample tests that we have in the repository. Build and run those on your iOS device. that will demonstrate all of the features that are implemented in the framework.
Feb 12, 2014 at 8:32 PM
Tried that. The project won't build here on VS2013:

1>------ Build started: Project: cocos2d.iOS, Configuration: Debug iPhone ------
1>C:\Users\rene\Source\Repos\cocos2d-xna\cocos2d\cocos2d.iOS.csproj(85,3): warning MSB4011: "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.targets" cannot be imported again. It was already imported at "C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets (22,2)". This is most likely a build authoring error. This subsequent import will be ignored.
1>C:\Users\rene\Source\Repos\MonoGame\MonoGame.Framework\MonoGame.Framework.iOS.csproj(461,3): warning MSB4011: "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.targets" cannot be imported again. It was already imported at "C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets (22,2)". This is most likely a build authoring error. This subsequent import will be ignored.
1>C:\Users\rene\Source\Repos\MonoGame\ThirdParty\Lidgren.Network\Lidgren.Network.iOS.csproj(42,3): warning MSB4011: "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.targets" cannot be imported again. It was already imported at "C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets (22,2)". This is most likely a build authoring error. This subsequent import will be ignored.
1> cocos2d.iOS -> C:\Users\rene\Source\Repos\cocos2d-xna\cocos2d\bin\iPhone\Debug\cocos2d-xna.dll
2>------ Build started: Project: tests.iOS, Configuration: Debug iPhone ------
2>C:\Users\rene\Source\Repos\cocos2d-xna\tests\tests\tests.iOS.csproj(1648,3): warning MSB4011: "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.CSharp.targets" cannot be imported again. It was already imported at "C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets (22,2)". This is most likely a build authoring error. This subsequent import will be ignored.
========== Build: 1 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Coordinator
Feb 12, 2014 at 8:35 PM
What is your repository URL?

Try building with Xamarin Studio on the Mac instead of VS2013.
Feb 12, 2014 at 8:42 PM
I will give that a try. For now I was able to create a new game from the templates under VS2013 for iOS and Windows GL. That's something to work with. I will simply start building my test game from there.