{"action":"opened","issue":{"url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6007","repository_url":"https://api.github.com/repos/MonoGame/MonoGame","labels_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6007/labels{/name}","comments_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6007/comments","events_url":"https://api.github.com/repos/MonoGame/MonoGame/issues/6007/events","html_url":"https://github.com/MonoGame/MonoGame/issues/6007","id":265324042,"number":6007,"title":"NullReferenceException in `Game.get_IsActive` on iOS with F#","user":{"login":"torbonde","id":5451931,"avatar_url":"https://avatars3.githubusercontent.com/u/5451931?v=4","gravatar_id":"","url":"https://api.github.com/users/torbonde","html_url":"https://github.com/torbonde","followers_url":"https://api.github.com/users/torbonde/followers","following_url":"https://api.github.com/users/torbonde/following{/other_user}","gists_url":"https://api.github.com/users/torbonde/gists{/gist_id}","starred_url":"https://api.github.com/users/torbonde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torbonde/subscriptions","organizations_url":"https://api.github.com/users/torbonde/orgs","repos_url":"https://api.github.com/users/torbonde/repos","events_url":"https://api.github.com/users/torbonde/events{/privacy}","received_events_url":"https://api.github.com/users/torbonde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-13T15:12:54Z","updated_at":"2017-10-13T15:12:54Z","closed_at":null,"author_association":"NONE","body":"This was first raised as a question on StackOverflow, but it was suggested that I created an issue here instead.\r\n\r\nI'm trying to build a simple MonoGame app for iOS using F#. I have done this by manually cooking up a fsproj file, on the basis of project files for\r\n\r\nF# iOS Single Page Application (template),\r\nF# console application (template) and\r\nC# iOS MonoGame (template).\r\nMy code looks like this:\r\n\r\n```\r\nnamespace MonoGameFSharpTemplate\r\n\r\nmodule Game =\r\n    open Microsoft.Xna.Framework\r\n    open Microsoft.Xna.Framework.Graphics\r\n    open Microsoft.Xna.Framework.Input\r\n    open Microsoft.Devices.Sensors\r\n\r\n    type Game1 () as x =\r\n        inherit Game()\r\n\r\n        do x.Content.RootDirectory <- \"Content\"\r\n        member val graphics = new GraphicsDeviceManager(x) with get, set\r\n\r\n        override x.Initialize() =\r\n            do base.Initialize()\r\n\r\n        override x.LoadContent() = ()\r\n\r\n        override x.Update (gameTime) =\r\n            do base.Update(gameTime)\r\n\r\n        override x.Draw (gameTime) =\r\n            do base.Draw(gameTime)\r\n\r\nmodule App =\r\n    open UIKit\r\n    open Foundation\r\n    open Game\r\n\r\n    [<Register(\"AppDelegate\")>]\r\n    type AppDelegate() =\r\n        inherit UIApplicationDelegate()\r\n\r\n        override val Window = null with get, set\r\n\r\n        override this.FinishedLaunching(app, options) =\r\n            use game = new Game1()\r\n            game.Run()\r\n            true\r\n\r\nmodule Main =\r\n    open UIKit\r\n\r\n    [<EntryPoint>]\r\n    let main argv = \r\n        UIApplication.Main(argv, null, \"AppDelegate\")\r\n        0\r\n```\r\n\r\nIt should be pretty much equivalent to the code provided in the C# template (which runs just fine, by the way).\r\n\r\nWhen running this code in the iOS simulator, I get a `NullReferenceException` with the following stack trace\r\n```\r\n  at Microsoft.Xna.Framework.Game.get_IsActive () [0x00000] in <d3066bb8224f42c4ab3ae66d66329856>:0 \r\n  at Microsoft.Xna.Framework.iOSGamePlatform.Tick () [0x00006] in <d3066bb8224f42c4ab3ae66d66329856>:0 \r\n  at Microsoft.Xna.Framework.iOSGameView.DoTick () [0x00000] in <d3066bb8224f42c4ab3ae66d66329856>:0 \r\n  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)\r\n  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/src/UIKit/UIApplication.cs:79 \r\n  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5024/152b654a/source/xamarin-macios/src/UIKit/UIApplication.cs:63 \r\n  at MonoGameFSharpTemplate.Main.main (System.String[] argv) [0x00000] in /Users/torbonde/Projects/MonoGameFSharpTemplate/MonoGameFSharpTemplate/Program.fs:47 \r\n```\r\n\r\nI'm running MonoGame build, v3.7.0.937, but I had the same issue using v3.6.\r\n\r\nIs this a known issue, and is there a fix/workaround? I have had a look at the code here in this repo, where the exception seems to occur, but I can't seem to locate the issue."}}
{"actor":{"display_login":"torbonde"}}