{"action":"created","comment":{"url":"https://api.github.com/repos/mono/MonoGame/pulls/comments/48111876","id":48111876,"diff_hunk":"@@ -951,10 +967,22 @@ public void PlatformPresent()\n \n                 // The first argument instructs DXGI to block n VSyncs before presenting.\n                 lock (_d3dContext)\n+                {\n                     _swapChain.Present(syncInterval, PresentFlags.None);\n+                    // Try setting the fullscreen state if it failed because of the device not being ready during CreateSizeDependentResources()\n+                    if (_shouldRetrySettingFullscreen)\n+                    {\n+                        _swapChain.SetFullscreenState(PresentationParameters.IsFullScreen, null);\n+                        _shouldRetrySettingFullscreen = false;\n+                    }\n+                }\n             }\n-            catch (SharpDX.SharpDXException)\n+            catch (SharpDX.SharpDXException ex)\n             {\n+                // Exception related to the device not being ready shall be silent because it can safely retry to set the fullscreen mode later\n+                if (_shouldRetrySettingFullscreen && unchecked((uint)ex.ResultCode.Code) != 0x887A0022)","path":"MonoGame.Framework/Graphics/GraphicsDevice.DirectX.cs","position":50,"original_position":50,"commit_id":"7a5b1aeaf8a53f307ae9908faa9eb1dae67eff67","original_commit_id":"7a5b1aeaf8a53f307ae9908faa9eb1dae67eff67","user":{"login":"MichaelDePiazzi","id":5249498,"avatar_url":"https://avatars.githubusercontent.com/u/5249498?v=3","gravatar_id":"","url":"https://api.github.com/users/MichaelDePiazzi","html_url":"https://github.com/MichaelDePiazzi","followers_url":"https://api.github.com/users/MichaelDePiazzi/followers","following_url":"https://api.github.com/users/MichaelDePiazzi/following{/other_user}","gists_url":"https://api.github.com/users/MichaelDePiazzi/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelDePiazzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelDePiazzi/subscriptions","organizations_url":"https://api.github.com/users/MichaelDePiazzi/orgs","repos_url":"https://api.github.com/users/MichaelDePiazzi/repos","events_url":"https://api.github.com/users/MichaelDePiazzi/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelDePiazzi/received_events","type":"User","site_admin":false},"body":"This logic is incorrect. It should be:\r\n```c#\r\nif (!(_shouldRetrySettingFullscreen && unchecked((uint)ex.ResultCode.Code) == 0x887A0022))\r\n```\r\nOr alternatively:\r\n```c#\r\nif (!_shouldRetrySettingFullscreen || unchecked((uint)ex.ResultCode.Code) != 0x887A0022)\r\n```","created_at":"2015-12-21T01:31:13Z","updated_at":"2015-12-21T01:31:13Z","html_url":"https://github.com/mono/MonoGame/pull/4337#discussion_r48111876","pull_request_url":"https://api.github.com/repos/mono/MonoGame/pulls/4337","_links":{"self":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/comments/48111876"},"html":{"href":"https://github.com/mono/MonoGame/pull/4337#discussion_r48111876"},"pull_request":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/4337"}}},"pull_request":{"url":"https://api.github.com/repos/mono/MonoGame/pulls/4337","id":54099251,"html_url":"https://github.com/mono/MonoGame/pull/4337","diff_url":"https://github.com/mono/MonoGame/pull/4337.diff","patch_url":"https://github.com/mono/MonoGame/pull/4337.patch","issue_url":"https://api.github.com/repos/mono/MonoGame/issues/4337","number":4337,"state":"open","locked":false,"title":"[Direct3D] Fix setting fullscreen state while device not being ready","user":{"login":"mrhelmut","id":3427451,"avatar_url":"https://avatars.githubusercontent.com/u/3427451?v=3","gravatar_id":"","url":"https://api.github.com/users/mrhelmut","html_url":"https://github.com/mrhelmut","followers_url":"https://api.github.com/users/mrhelmut/followers","following_url":"https://api.github.com/users/mrhelmut/following{/other_user}","gists_url":"https://api.github.com/users/mrhelmut/gists{/gist_id}","starred_url":"https://api.github.com/users/mrhelmut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrhelmut/subscriptions","organizations_url":"https://api.github.com/users/mrhelmut/orgs","repos_url":"https://api.github.com/users/mrhelmut/repos","events_url":"https://api.github.com/users/mrhelmut/events{/privacy}","received_events_url":"https://api.github.com/users/mrhelmut/received_events","type":"User","site_admin":false},"body":"Fixes #4148\r\n\r\nI'm not 100% confident about this one. What should be checked:\r\n- if it uses the correct method to compare exception's HRESULT\r\n- if it is safe to retry setting the fullscreen state after ```_swapChain.Present(syncInterval, PresentFlags.None);```\r\n\r\nThis bug is really hard to reproduce, so I'm going to roll this PR out to our game today and will check if the problem is still referenced in our crash reports DB over the week. I've never been able to observe it locally, but we're typically getting about 1 of these crashes per day, so I'll be able to monitor its occurrence.\r\n\r\nUPDATE: I can already tell that it still occurs. I'm most probably not comparing the HRESULT correctly.","created_at":"2015-12-18T12:53:46Z","updated_at":"2015-12-21T01:31:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60e669c6204320cbe7002c1fa943a3ecea2fce74","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mono/MonoGame/pulls/4337/commits","review_comments_url":"https://api.github.com/repos/mono/MonoGame/pulls/4337/comments","review_comment_url":"https://api.github.com/repos/mono/MonoGame/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mono/MonoGame/issues/4337/comments","statuses_url":"https://api.github.com/repos/mono/MonoGame/statuses/7a5b1aeaf8a53f307ae9908faa9eb1dae67eff67","head":{"label":"mrhelmut:DirectXFullscreenFix","ref":"DirectXFullscreenFix","sha":"7a5b1aeaf8a53f307ae9908faa9eb1dae67eff67","user":{"login":"mrhelmut","id":3427451,"avatar_url":"https://avatars.githubusercontent.com/u/3427451?v=3","gravatar_id":"","url":"https://api.github.com/users/mrhelmut","html_url":"https://github.com/mrhelmut","followers_url":"https://api.github.com/users/mrhelmut/followers","following_url":"https://api.github.com/users/mrhelmut/following{/other_user}","gists_url":"https://api.github.com/users/mrhelmut/gists{/gist_id}","starred_url":"https://api.github.com/users/mrhelmut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrhelmut/subscriptions","organizations_url":"https://api.github.com/users/mrhelmut/orgs","repos_url":"https://api.github.com/users/mrhelmut/repos","events_url":"https://api.github.com/users/mrhelmut/events{/privacy}","received_events_url":"https://api.github.com/users/mrhelmut/received_events","type":"User","site_admin":false},"repo":{"id":28665606,"name":"MonoGame","full_name":"mrhelmut/MonoGame","owner":{"login":"mrhelmut","id":3427451,"avatar_url":"https://avatars.githubusercontent.com/u/3427451?v=3","gravatar_id":"","url":"https://api.github.com/users/mrhelmut","html_url":"https://github.com/mrhelmut","followers_url":"https://api.github.com/users/mrhelmut/followers","following_url":"https://api.github.com/users/mrhelmut/following{/other_user}","gists_url":"https://api.github.com/users/mrhelmut/gists{/gist_id}","starred_url":"https://api.github.com/users/mrhelmut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrhelmut/subscriptions","organizations_url":"https://api.github.com/users/mrhelmut/orgs","repos_url":"https://api.github.com/users/mrhelmut/repos","events_url":"https://api.github.com/users/mrhelmut/events{/privacy}","received_events_url":"https://api.github.com/users/mrhelmut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrhelmut/MonoGame","description":"Working fork of MonoGame used in Flying Oak Games projects. (May not be up to date compared to the mono/MonoGame repo and may contain yet-to-be-approved code)","fork":true,"url":"https://api.github.com/repos/mrhelmut/MonoGame","forks_url":"https://api.github.com/repos/mrhelmut/MonoGame/forks","keys_url":"https://api.github.com/repos/mrhelmut/MonoGame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrhelmut/MonoGame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrhelmut/MonoGame/teams","hooks_url":"https://api.github.com/repos/mrhelmut/MonoGame/hooks","issue_events_url":"https://api.github.com/repos/mrhelmut/MonoGame/issues/events{/number}","events_url":"https://api.github.com/repos/mrhelmut/MonoGame/events","assignees_url":"https://api.github.com/repos/mrhelmut/MonoGame/assignees{/user}","branches_url":"https://api.github.com/repos/mrhelmut/MonoGame/branches{/branch}","tags_url":"https://api.github.com/repos/mrhelmut/MonoGame/tags","blobs_url":"https://api.github.com/repos/mrhelmut/MonoGame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrhelmut/MonoGame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrhelmut/MonoGame/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrhelmut/MonoGame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrhelmut/MonoGame/statuses/{sha}","languages_url":"https://api.github.com/repos/mrhelmut/MonoGame/languages","stargazers_url":"https://api.github.com/repos/mrhelmut/MonoGame/stargazers","contributors_url":"https://api.github.com/repos/mrhelmut/MonoGame/contributors","subscribers_url":"https://api.github.com/repos/mrhelmut/MonoGame/subscribers","subscription_url":"https://api.github.com/repos/mrhelmut/MonoGame/subscription","commits_url":"https://api.github.com/repos/mrhelmut/MonoGame/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrhelmut/MonoGame/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrhelmut/MonoGame/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrhelmut/MonoGame/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrhelmut/MonoGame/contents/{+path}","compare_url":"https://api.github.com/repos/mrhelmut/MonoGame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrhelmut/MonoGame/merges","archive_url":"https://api.github.com/repos/mrhelmut/MonoGame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrhelmut/MonoGame/downloads","issues_url":"https://api.github.com/repos/mrhelmut/MonoGame/issues{/number}","pulls_url":"https://api.github.com/repos/mrhelmut/MonoGame/pulls{/number}","milestones_url":"https://api.github.com/repos/mrhelmut/MonoGame/milestones{/number}","notifications_url":"https://api.github.com/repos/mrhelmut/MonoGame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrhelmut/MonoGame/labels{/name}","releases_url":"https://api.github.com/repos/mrhelmut/MonoGame/releases{/id}","created_at":"2014-12-31T12:37:05Z","updated_at":"2015-05-07T11:23:04Z","pushed_at":"2015-12-18T12:43:33Z","git_url":"git://github.com/mrhelmut/MonoGame.git","ssh_url":"git@github.com:mrhelmut/MonoGame.git","clone_url":"https://github.com/mrhelmut/MonoGame.git","svn_url":"https://github.com/mrhelmut/MonoGame","homepage":"http://flying-oak.com/","size":51361,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"mono:develop","ref":"develop","sha":"50a348a6ce7dae4e397353b7459c37d906dce587","user":{"login":"mono","id":53395,"avatar_url":"https://avatars.githubusercontent.com/u/53395?v=3","gravatar_id":"","url":"https://api.github.com/users/mono","html_url":"https://github.com/mono","followers_url":"https://api.github.com/users/mono/followers","following_url":"https://api.github.com/users/mono/following{/other_user}","gists_url":"https://api.github.com/users/mono/gists{/gist_id}","starred_url":"https://api.github.com/users/mono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mono/subscriptions","organizations_url":"https://api.github.com/users/mono/orgs","repos_url":"https://api.github.com/users/mono/repos","events_url":"https://api.github.com/users/mono/events{/privacy}","received_events_url":"https://api.github.com/users/mono/received_events","type":"Organization","site_admin":false},"repo":{"id":1579990,"name":"MonoGame","full_name":"mono/MonoGame","owner":{"login":"mono","id":53395,"avatar_url":"https://avatars.githubusercontent.com/u/53395?v=3","gravatar_id":"","url":"https://api.github.com/users/mono","html_url":"https://github.com/mono","followers_url":"https://api.github.com/users/mono/followers","following_url":"https://api.github.com/users/mono/following{/other_user}","gists_url":"https://api.github.com/users/mono/gists{/gist_id}","starred_url":"https://api.github.com/users/mono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mono/subscriptions","organizations_url":"https://api.github.com/users/mono/orgs","repos_url":"https://api.github.com/users/mono/repos","events_url":"https://api.github.com/users/mono/events{/privacy}","received_events_url":"https://api.github.com/users/mono/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mono/MonoGame","description":"One framework for creating powerful cross-platform games.","fork":false,"url":"https://api.github.com/repos/mono/MonoGame","forks_url":"https://api.github.com/repos/mono/MonoGame/forks","keys_url":"https://api.github.com/repos/mono/MonoGame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mono/MonoGame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mono/MonoGame/teams","hooks_url":"https://api.github.com/repos/mono/MonoGame/hooks","issue_events_url":"https://api.github.com/repos/mono/MonoGame/issues/events{/number}","events_url":"https://api.github.com/repos/mono/MonoGame/events","assignees_url":"https://api.github.com/repos/mono/MonoGame/assignees{/user}","branches_url":"https://api.github.com/repos/mono/MonoGame/branches{/branch}","tags_url":"https://api.github.com/repos/mono/MonoGame/tags","blobs_url":"https://api.github.com/repos/mono/MonoGame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mono/MonoGame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mono/MonoGame/git/refs{/sha}","trees_url":"https://api.github.com/repos/mono/MonoGame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mono/MonoGame/statuses/{sha}","languages_url":"https://api.github.com/repos/mono/MonoGame/languages","stargazers_url":"https://api.github.com/repos/mono/MonoGame/stargazers","contributors_url":"https://api.github.com/repos/mono/MonoGame/contributors","subscribers_url":"https://api.github.com/repos/mono/MonoGame/subscribers","subscription_url":"https://api.github.com/repos/mono/MonoGame/subscription","commits_url":"https://api.github.com/repos/mono/MonoGame/commits{/sha}","git_commits_url":"https://api.github.com/repos/mono/MonoGame/git/commits{/sha}","comments_url":"https://api.github.com/repos/mono/MonoGame/comments{/number}","issue_comment_url":"https://api.github.com/repos/mono/MonoGame/issues/comments{/number}","contents_url":"https://api.github.com/repos/mono/MonoGame/contents/{+path}","compare_url":"https://api.github.com/repos/mono/MonoGame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mono/MonoGame/merges","archive_url":"https://api.github.com/repos/mono/MonoGame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mono/MonoGame/downloads","issues_url":"https://api.github.com/repos/mono/MonoGame/issues{/number}","pulls_url":"https://api.github.com/repos/mono/MonoGame/pulls{/number}","milestones_url":"https://api.github.com/repos/mono/MonoGame/milestones{/number}","notifications_url":"https://api.github.com/repos/mono/MonoGame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mono/MonoGame/labels{/name}","releases_url":"https://api.github.com/repos/mono/MonoGame/releases{/id}","created_at":"2011-04-07T00:23:40Z","updated_at":"2015-12-20T17:36:30Z","pushed_at":"2015-12-21T00:44:34Z","git_url":"git://github.com/mono/MonoGame.git","ssh_url":"git@github.com:mono/MonoGame.git","clone_url":"https://github.com/mono/MonoGame.git","svn_url":"https://github.com/mono/MonoGame","homepage":"http://www.monogame.net","size":330658,"stargazers_count":3063,"watchers_count":3063,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1676,"mirror_url":null,"open_issues_count":695,"forks":1676,"open_issues":695,"watchers":3063,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/4337"},"html":{"href":"https://github.com/mono/MonoGame/pull/4337"},"issue":{"href":"https://api.github.com/repos/mono/MonoGame/issues/4337"},"comments":{"href":"https://api.github.com/repos/mono/MonoGame/issues/4337/comments"},"review_comments":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/4337/comments"},"review_comment":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mono/MonoGame/pulls/4337/commits"},"statuses":{"href":"https://api.github.com/repos/mono/MonoGame/statuses/7a5b1aeaf8a53f307ae9908faa9eb1dae67eff67"}}}}