{"action":"closed","issue":{"url":"https://api.github.com/repos/SeleniumHQ/selenium/issues/4645","repository_url":"https://api.github.com/repos/SeleniumHQ/selenium","labels_url":"https://api.github.com/repos/SeleniumHQ/selenium/issues/4645/labels{/name}","comments_url":"https://api.github.com/repos/SeleniumHQ/selenium/issues/4645/comments","events_url":"https://api.github.com/repos/SeleniumHQ/selenium/issues/4645/events","html_url":"https://github.com/SeleniumHQ/selenium/issues/4645","id":255773712,"number":4645,"title":"Dotnet - Attempt to save a screenshot to a directory which does not exist throw a cryptic generic GDI error","user":{"login":"sandorfr","id":2660262,"avatar_url":"https://avatars3.githubusercontent.com/u/2660262?v=4","gravatar_id":"","url":"https://api.github.com/users/sandorfr","html_url":"https://github.com/sandorfr","followers_url":"https://api.github.com/users/sandorfr/followers","following_url":"https://api.github.com/users/sandorfr/following{/other_user}","gists_url":"https://api.github.com/users/sandorfr/gists{/gist_id}","starred_url":"https://api.github.com/users/sandorfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandorfr/subscriptions","organizations_url":"https://api.github.com/users/sandorfr/orgs","repos_url":"https://api.github.com/users/sandorfr/repos","events_url":"https://api.github.com/users/sandorfr/events{/privacy}","received_events_url":"https://api.github.com/users/sandorfr/received_events","type":"User","site_admin":false},"labels":[{"id":182503933,"url":"https://api.github.com/repos/SeleniumHQ/selenium/labels/C-dotnet","name":"C-dotnet","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-06T23:43:28Z","updated_at":"2018-03-22T00:48:51Z","closed_at":"2018-03-22T00:48:51Z","author_association":"NONE","body":"## Meta -\r\nOS:  \r\nWindows\r\nSelenium Version:  \r\n3.5.1\r\nBrowser:  \r\nany\r\n\r\nBrowser Version:  \r\nany\r\n\r\nWhen we try to save a screenshot to a directory which does not exist, It throws with the following error:\r\n```\r\nA generic error occurred in GDI+\r\n```\r\n\r\n## Expected Behavior -\r\nIt should either create the directory or throw an explicit `DirectoryNotFoundException`\r\n\r\n## Actual Behavior -\r\nIt throws a cryptic generic GDI exception\r\n\r\n## Steps to reproduce -\r\n\r\nAdd the following to an existing test\r\n```csharp\r\n\r\n                var testScreenShotPath = \"C:\\\\PathToADirectoryWhichDoesNotExists\";                \r\n                var path = Path.Combine(testScreenShotPath, ${Guid.NewGuid()}.jpg\");\r\n                var screenshot = ((ITakesScreenshot)BrowserInstance).GetScreenshot();\r\n                screenshot.SaveAsFile(path, ScreenshotImageFormat.Jpeg);\r\n```\r\n\r\nRun the test\r\n\r\nAdditional reference can be found [on Stackoverflow](https://stackoverflow.com/questions/29973934/a-generic-error-occurred-in-gdi-screenshot-saveasfile-externalexception)\r\n"}}
{"actor":{"display_login":"jimevans"}}