{"action":"created","issue":{"url":"https://api.github.com/repos/mono/MonoGame/issues/5042","repository_url":"https://api.github.com/repos/mono/MonoGame","labels_url":"https://api.github.com/repos/mono/MonoGame/issues/5042/labels{/name}","comments_url":"https://api.github.com/repos/mono/MonoGame/issues/5042/comments","events_url":"https://api.github.com/repos/mono/MonoGame/issues/5042/events","html_url":"https://github.com/mono/MonoGame/issues/5042","id":168194539,"number":5042,"title":"NUnit Failure","user":{"login":"tomspilman","id":103522,"avatar_url":"https://avatars.githubusercontent.com/u/103522?v=3","gravatar_id":"","url":"https://api.github.com/users/tomspilman","html_url":"https://github.com/tomspilman","followers_url":"https://api.github.com/users/tomspilman/followers","following_url":"https://api.github.com/users/tomspilman/following{/other_user}","gists_url":"https://api.github.com/users/tomspilman/gists{/gist_id}","starred_url":"https://api.github.com/users/tomspilman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomspilman/subscriptions","organizations_url":"https://api.github.com/users/tomspilman/orgs","repos_url":"https://api.github.com/users/tomspilman/repos","events_url":"https://api.github.com/users/tomspilman/events{/privacy}","received_events_url":"https://api.github.com/users/tomspilman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mono/MonoGame/labels/Help%20Wanted","name":"Help Wanted","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/mono/MonoGame/milestones/9","html_url":"https://github.com/mono/MonoGame/milestones/3.6%20Release","labels_url":"https://api.github.com/repos/mono/MonoGame/milestones/9/labels","id":1441958,"number":9,"title":"3.6 Release","description":"More unit tests, running unit tests on Mac and Linux, SDL2 replacing OpenTK.","creator":{"login":"dellis1972","id":810617,"avatar_url":"https://avatars.githubusercontent.com/u/810617?v=3","gravatar_id":"","url":"https://api.github.com/users/dellis1972","html_url":"https://github.com/dellis1972","followers_url":"https://api.github.com/users/dellis1972/followers","following_url":"https://api.github.com/users/dellis1972/following{/other_user}","gists_url":"https://api.github.com/users/dellis1972/gists{/gist_id}","starred_url":"https://api.github.com/users/dellis1972/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dellis1972/subscriptions","organizations_url":"https://api.github.com/users/dellis1972/orgs","repos_url":"https://api.github.com/users/dellis1972/repos","events_url":"https://api.github.com/users/dellis1972/events{/privacy}","received_events_url":"https://api.github.com/users/dellis1972/received_events","type":"User","site_admin":false},"open_issues":97,"closed_issues":100,"state":"open","created_at":"2015-12-03T11:17:13Z","updated_at":"2016-08-02T13:39:01Z","due_on":"2016-06-13T07:00:00Z","closed_at":null},"comments":2,"created_at":"2016-07-28T20:55:20Z","updated_at":"2016-08-02T21:34:55Z","closed_at":null,"body":"We're currently experiencing some sort of error running unit tests under TeamCity.\r\n\r\nA build from a July 18th shows 803 tests run:\r\n\r\nhttp://teamcity.monogame.net/viewLog.html?buildId=18960&buildTypeId=MonoGame_TestWindows&tab=buildResultsDiv\r\n\r\nA build a few days later on July 22nd shows only 398 tests run:\r\n\r\nhttp://teamcity.monogame.net/viewLog.html?buildId=19164&buildTypeId=MonoGame_TestWindows&tab=buildResultsDiv\r\n\r\nLooking further the unit tests seem to be failing mid run:\r\n\r\n```\r\n[17:41:56]E:\t\t\t [MonoGameTests.exe] MonoGame.Tests.Framework.SpriteFontNonVisualTest.MeasureString_returns_correct_values(\"JingJing\",\"%\",21,45) (2s)\r\n[17:41:57]E:\t\t\t\t [MonoGame.Tests.Framework.SpriteFontNonVisualTest.MeasureString_returns_correct_values(\"JingJing\",\"%\",21,45)] [Test Error Output]\r\nSystem.NullReferenceException: Object reference not set to an instance of an object.\r\n   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter, Boolean tracing, LoggingThreshold logLevel)\r\n   at NUnit.Core.TestRunnerThread.TestRunnerThreadProc()\r\n[17:41:57]W:\t\t\t\t [MonoGame.Tests.Framework.SpriteFontNonVisualTest.MeasureString_returns_correct_values(\"JingJing\",\"%\",21,45)] [Test Error Output]\r\nUnhandled exception in remote appdomain: System.ApplicationException: Exception in TestRunnerThread ---> System.NullReferenceException: Object reference not set to an instance of an object.\r\n   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.RunSuite(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.RunSuiteInContext(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)\r\n   at NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter, Boolean tracing, LoggingThreshold logLevel)\r\n   at NUnit.Core.TestRunnerThread.TestRunnerThreadProc()\r\n   --- End of inner exception stack trace ---\r\n   at NUnit.Core.TestRunnerThread.TestRunnerThreadProc()\r\n   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Threading.ThreadHelper.ThreadStart()\r\n```\r\n\r\nThis doesn't look like any failure in the unit tests themselves...  this looks like some failure within NUnit itself.\r\n\r\nI don't know why it suddenly started failing... there have been no changes to how unit tests are run in quite a while.\r\n\r\nNote we're currently running on an old version of NUnit 2.6.0 which is from February 20, 2012.  Could be we should just upgrade to the latest NUnit release to solve this.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mono/MonoGame/issues/comments/237052143","html_url":"https://github.com/mono/MonoGame/issues/5042#issuecomment-237052143","issue_url":"https://api.github.com/repos/mono/MonoGame/issues/5042","id":237052143,"user":{"login":"Jjagg","id":14875382,"avatar_url":"https://avatars.githubusercontent.com/u/14875382?v=3","gravatar_id":"","url":"https://api.github.com/users/Jjagg","html_url":"https://github.com/Jjagg","followers_url":"https://api.github.com/users/Jjagg/followers","following_url":"https://api.github.com/users/Jjagg/following{/other_user}","gists_url":"https://api.github.com/users/Jjagg/gists{/gist_id}","starred_url":"https://api.github.com/users/Jjagg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jjagg/subscriptions","organizations_url":"https://api.github.com/users/Jjagg/orgs","repos_url":"https://api.github.com/users/Jjagg/repos","events_url":"https://api.github.com/users/Jjagg/events{/privacy}","received_events_url":"https://api.github.com/users/Jjagg/received_events","type":"User","site_admin":false},"created_at":"2016-08-02T21:34:55Z","updated_at":"2016-08-02T21:34:55Z","body":"@tomspilman The issue here is that DynamicSoundEffectInstances are not disposed when Game is disposed. The Audio testing forgot to dispose some SoundEffects and on the first test after that that uses a Game crashes when it's disposed and attempts to dispose the XAudio MasterVoice [here](https://github.com/mono/MonoGame/blob/develop/MonoGame.Framework/Audio/SoundEffect.XAudio.cs#L353). I have no idea why the tests sometimes just worked on the build server, but luckily they consistently failed locally, which helped pinpoint the issue. I got it down to running one audio test and one test that uses a Game and noticed it didn't dispose a sound effect (https://github.com/mono/MonoGame/blob/develop/Test/Framework/Audio/DynamicSoundEffectInstanceTest.cs#L172). Disposing it fixed the issue.\r\n\r\nI'll make sure DynamicSoundEffects are disposed in the tests. Maybe dynamic sound effects also be added to some static collection so they can always be properly disposed?"}}
{"actor":{"display_login":"Jjagg"}}