{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/8","labels_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/8/comments","events_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/8/events","html_url":"https://github.com/PowerShell/DscResource.Tests/issues/8","id":111050499,"number":8,"title":"Module installation of xDscResourceDesigner failed with exit code    at <ScriptBlock>","user":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PowerShell/DscResource.Tests/labels/Waiting%20for%20the%20author","name":"Waiting for the author","color":"e6e6e6"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-10-12T20:33:57Z","updated_at":"2015-11-05T04:00:09Z","closed_at":null,"body":"I often receive the following error when invoking pester testing when the DSCResource.Tests is included in the project:\r\n[-] Error occurred in test script 'C:\\projects\\xnetworking\\DscResource.Tests\\Meta.Tests.ps1' 22.92s\r\n  Module installation of xDscResourceDesigner failed with exit code \r\n  at <ScriptBlock>, C:\\projects\\xnetworking\\DscResource.Tests\\Meta.Tests.ps1: line 46\r\n\r\n![2015-10-13_9-24-57](https://cloud.githubusercontent.com/assets/7589164/10437986/474e86c6-718d-11e5-94f3-9624c92375fd.png)\r\n\r\n\r\nThis error is completely random and only occurs about 50% of the time. If I Invoke the pester tests again it usually works correctly with no error. This wouldn't usually be too much of a problem, but the issue also occurs up in AppVeyor where I might not have permission to re-build a commit - unless I actually commit something - which is more of a problem.\r\n\r\nThis maybe a connection or download issue but I'm not sure. Any help would be appreciated!"},"comment":{"url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/comments/153949247","html_url":"https://github.com/PowerShell/DscResource.Tests/issues/8#issuecomment-153949247","issue_url":"https://api.github.com/repos/PowerShell/DscResource.Tests/issues/8","id":153949247,"user":{"login":"PlagueHO","id":7589164,"avatar_url":"https://avatars.githubusercontent.com/u/7589164?v=3","gravatar_id":"","url":"https://api.github.com/users/PlagueHO","html_url":"https://github.com/PlagueHO","followers_url":"https://api.github.com/users/PlagueHO/followers","following_url":"https://api.github.com/users/PlagueHO/following{/other_user}","gists_url":"https://api.github.com/users/PlagueHO/gists{/gist_id}","starred_url":"https://api.github.com/users/PlagueHO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PlagueHO/subscriptions","organizations_url":"https://api.github.com/users/PlagueHO/orgs","repos_url":"https://api.github.com/users/PlagueHO/repos","events_url":"https://api.github.com/users/PlagueHO/events{/privacy}","received_events_url":"https://api.github.com/users/PlagueHO/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T04:00:09Z","updated_at":"2015-11-05T04:00:09Z","body":"I think I've found the issue with the call to Nuget and resolved it. It seems that Start-Process is actually causing a problem here because I was still occasionally running into the exact same problem when calling Git.exe (using Start-Process as well) where a blank error code. So, I replaced the fancy start-process code with just a plain old & call and then check the $LASTEXITCODE parameter and the problem seems to go away.\r\n\r\nI've also switched to using the Nuget-Anycpu.exe that is downloaded with the Get-PackageProvider cmdlet rather than use the Nuget.exe that is automatically available on the AppVeyor servers. This allows the code to work on fresh Windows machines.\r\n\r\nAnd finally, what I've also done is change the code so that rather than use NuGet it will first check for the PowerShellGet module and use that if available (e.g. Install-Module xDSCResourceDesigner). If it the module is not available it'll use the Nuget-AnyCPU.exe call (which now works). If that fails then the Git method will be tried.\r\n\r\nAlso, the reason why I'm checking for the PowerShellGet Module rather than testing for WMF5 is that MS released PowerShellGet (at least a preview anyway) for WM3 and WMF4 a few weeks back, so it might be available on some servers without WMF5: https://www.microsoft.com/en-us/download/details.aspx?id=49186\r\n\r\nI've also moved this code all out into a separate function in the TestHelper module. There is a **DownloadUsing** parameter that can be passed that will control which download methods to try:\r\n        **Nuget:** Download from Nuget (or PSGet if available) only - if fails will terminate.\r\n        **Git:** Download from Git only - if fails will terminate.\r\n        **NugetThenGit:** Download from Nuget (or PSGet if available), but if fails will try Git.\r\n\r\nIt defaults to **NugetThenGit**, but I'm thinking that we could change the default to Nuget now that the problem with Nuget seems to be resolved.\r\n\r\nI'll document this in the PR if the above sounds OK.\r\n\r\n\r\n\r\n"}}