{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-content/issues/7390","repository_url":"https://api.github.com/repos/Azure/azure-content","labels_url":"https://api.github.com/repos/Azure/azure-content/issues/7390/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-content/issues/7390/comments","events_url":"https://api.github.com/repos/Azure/azure-content/issues/7390/events","html_url":"https://github.com/Azure/azure-content/pull/7390","id":173301541,"number":7390,"title":"Stop further role initialization when restart is needed","user":{"login":"jnyrup","id":919634,"avatar_url":"https://avatars.githubusercontent.com/u/919634?v=3","gravatar_id":"","url":"https://api.github.com/users/jnyrup","html_url":"https://github.com/jnyrup","followers_url":"https://api.github.com/users/jnyrup/followers","following_url":"https://api.github.com/users/jnyrup/following{/other_user}","gists_url":"https://api.github.com/users/jnyrup/gists{/gist_id}","starred_url":"https://api.github.com/users/jnyrup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnyrup/subscriptions","organizations_url":"https://api.github.com/users/jnyrup/orgs","repos_url":"https://api.github.com/users/jnyrup/repos","events_url":"https://api.github.com/users/jnyrup/events{/privacy}","received_events_url":"https://api.github.com/users/jnyrup/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Azure/azure-content/labels/cla-not-required","name":"cla-not-required","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-25T20:27:45Z","updated_at":"2016-08-25T20:27:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Azure/azure-content/pulls/7390","html_url":"https://github.com/Azure/azure-content/pull/7390","diff_url":"https://github.com/Azure/azure-content/pull/7390.diff","patch_url":"https://github.com/Azure/azure-content/pull/7390.patch"},"body":"When a role needs to restart after installing a new .NET, `install.cmd` should exit with a non-zero value to prevent further role initialization.\r\n\r\nExample:\r\n* A role with with .NET 4.5 installed\r\n* Code in RoleEntryPoint.OnStart() that relies on .NET 4.6, e.g. [`System.Array.Empty()`](https://msdn.microsoft.com/en-us/library/dn906179(v=vs.110).aspx)\r\n\r\n* As the installation is executed without the /norestart switch it initiates a reboot after installation.\r\n* Install.cmd exits with 0\r\n* All startup tasks returns 0, so [initialization continues](https://azure.microsoft.com/en-us/documentation/articles/cloud-services-startup-tasks/) by executing RoleEntryPoint.OnStart()\r\n* A `System.MissingMethodException` is thrown, as `System.Array.Empty()` is not available in .NET 4.5\r\n* The role reboots\r\n* After rebooting no exceptions are thrown, as .NET 4.6 is now fully installed.\r\n \r\nIf `install.cmd` is placed as the first startup task and all tasks are executed synchronously, this should have *no* side-effects.\r\n\r\nAnyways startup tasks must be written with [precautions for multiple executions between reboots](https://azure.microsoft.com/da-dk/documentation/articles/cloud-services-startup-tasks-common/#detect-that-your-task-has-already-run).\r\n\r\nI have tested this change in `install.cmd` as a working solution to the example shown above."},"comment":{"url":"https://api.github.com/repos/Azure/azure-content/issues/comments/242527029","html_url":"https://github.com/Azure/azure-content/pull/7390#issuecomment-242527029","issue_url":"https://api.github.com/repos/Azure/azure-content/issues/7390","id":242527029,"user":{"login":"azurecla","id":8030856,"avatar_url":"https://avatars.githubusercontent.com/u/8030856?v=3","gravatar_id":"","url":"https://api.github.com/users/azurecla","html_url":"https://github.com/azurecla","followers_url":"https://api.github.com/users/azurecla/followers","following_url":"https://api.github.com/users/azurecla/following{/other_user}","gists_url":"https://api.github.com/users/azurecla/gists{/gist_id}","starred_url":"https://api.github.com/users/azurecla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azurecla/subscriptions","organizations_url":"https://api.github.com/users/azurecla/orgs","repos_url":"https://api.github.com/users/azurecla/repos","events_url":"https://api.github.com/users/azurecla/events{/privacy}","received_events_url":"https://api.github.com/users/azurecla/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T20:27:51Z","updated_at":"2016-08-25T20:27:51Z","body":"Hi __@jnyrup__, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!\n    <span>\n        This seems like a small (but important) contribution, so no contribution license agreement is required at this point. Real humans will now evaluate your PR.\n    </span>\n\nTTYL, AZPRBOT;\n"}}
{"actor":{"display_login":"azurecla"}}