{"action":"closed","number":814,"pull_request":{"url":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/814","id":231701755,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNzAxNzU1","html_url":"https://github.com/lzybkr/PSReadLine/pull/814","diff_url":"https://github.com/lzybkr/PSReadLine/pull/814.diff","patch_url":"https://github.com/lzybkr/PSReadLine/pull/814.patch","issue_url":"https://api.github.com/repos/lzybkr/PSReadLine/issues/814","number":814,"state":"closed","locked":false,"title":"Remove dependency on the Utility module","user":{"login":"daxian-dbw","id":127450,"node_id":"MDQ6VXNlcjEyNzQ1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/127450?v=4","gravatar_id":"","url":"https://api.github.com/users/daxian-dbw","html_url":"https://github.com/daxian-dbw","followers_url":"https://api.github.com/users/daxian-dbw/followers","following_url":"https://api.github.com/users/daxian-dbw/following{/other_user}","gists_url":"https://api.github.com/users/daxian-dbw/gists{/gist_id}","starred_url":"https://api.github.com/users/daxian-dbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daxian-dbw/subscriptions","organizations_url":"https://api.github.com/users/daxian-dbw/orgs","repos_url":"https://api.github.com/users/daxian-dbw/repos","events_url":"https://api.github.com/users/daxian-dbw/events{/privacy}","received_events_url":"https://api.github.com/users/daxian-dbw/received_events","type":"User","site_admin":false},"body":"#### Problem\r\n\r\nThe code `ps.AddCommand(\"Get-Variable\").AddParameter(\"Name\", \"host\").AddParameter(\"ValueOnly\")` triggers the loading of the `Utility` module at powershell startup time, which causes the following two PS assemblies being loaded:\r\n- Microsoft.PowerShell.Commands.Utility\r\n- Microsoft.PowerShell.MarkdownRender\r\n\r\nWhen loading the `Utility` module, powershell will go through all public types in `Utility.dll` to discover defined cmdlets. The type `PSMarkdownOptionInfo` is a property type used in a markdown cmdlet, and it's also used in the `OutputTypeAttribute` for two markdown cmdlets. So this type needs to be loaded during the cmdlet discovery. The type comes from `MarkdownRender.dll` and thus the `MarkdownRender.dll` gets implicitly loaded. \r\n\r\n#### Motivation\r\n\r\nThere are very likely other assemblies also being loaded implicitly during the cmdlet discovery of the `Utility` module. By changing the code to use `ps.AddScript(\"$Host\")` we can avoid the loading of `Utility` module, and thus reduce the reference set during powershell startup.\r\n\r\n#### Loaded PS assemblies before this change\r\n```powershell\r\ncmd > pwsh.exe -noprofile\r\nps > [System.AppDomain]::CurrentDomain.GetAssemblies() | ? FullName -Like \"*Microsoft.PowerShell*\" | % fullname\r\nMicrosoft.PowerShell.ConsoleHost, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.CoreCLR.Eventing, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.Security, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.PSReadLine2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null\r\nMicrosoft.PowerShell.Commands.Utility, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.MarkdownRender, Version=6.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\n```\r\n\r\n#### Loaded PS assemblies after this change\r\n```powershell\r\ncmd > pwsh.exe -noprofile\r\nps > [System.AppDomain]::CurrentDomain.GetAssemblies() | ? FullName -Like \"*Microsoft.PowerShell*\" | % fullname\r\nMicrosoft.PowerShell.ConsoleHost, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.CoreCLR.Eventing, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.Security, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nMicrosoft.PowerShell.PSReadLine2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null\r\n```","created_at":"2018-11-17T02:46:37Z","updated_at":"2018-11-26T18:46:24Z","closed_at":"2018-11-26T18:46:24Z","merged_at":"2018-11-26T18:46:24Z","merge_commit_sha":"ade48310d0e36553ae9d46812e2e7a905e7b8418","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/814/commits","review_comments_url":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/814/comments","review_comment_url":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lzybkr/PSReadLine/issues/814/comments","statuses_url":"https://api.github.com/repos/lzybkr/PSReadLine/statuses/c686c4745bb37ce522277723de0d8a5652b05333","head":{"label":"daxian-dbw:minor","ref":"minor","sha":"c686c4745bb37ce522277723de0d8a5652b05333","user":{"login":"daxian-dbw","id":127450,"node_id":"MDQ6VXNlcjEyNzQ1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/127450?v=4","gravatar_id":"","url":"https://api.github.com/users/daxian-dbw","html_url":"https://github.com/daxian-dbw","followers_url":"https://api.github.com/users/daxian-dbw/followers","following_url":"https://api.github.com/users/daxian-dbw/following{/other_user}","gists_url":"https://api.github.com/users/daxian-dbw/gists{/gist_id}","starred_url":"https://api.github.com/users/daxian-dbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daxian-dbw/subscriptions","organizations_url":"https://api.github.com/users/daxian-dbw/orgs","repos_url":"https://api.github.com/users/daxian-dbw/repos","events_url":"https://api.github.com/users/daxian-dbw/events{/privacy}","received_events_url":"https://api.github.com/users/daxian-dbw/received_events","type":"User","site_admin":false},"repo":{"id":118057489,"node_id":"MDEwOlJlcG9zaXRvcnkxMTgwNTc0ODk=","name":"PSReadLine","full_name":"daxian-dbw/PSReadLine","private":false,"owner":{"login":"daxian-dbw","id":127450,"node_id":"MDQ6VXNlcjEyNzQ1MA==","avatar_url":"https://avatars2.githubusercontent.com/u/127450?v=4","gravatar_id":"","url":"https://api.github.com/users/daxian-dbw","html_url":"https://github.com/daxian-dbw","followers_url":"https://api.github.com/users/daxian-dbw/followers","following_url":"https://api.github.com/users/daxian-dbw/following{/other_user}","gists_url":"https://api.github.com/users/daxian-dbw/gists{/gist_id}","starred_url":"https://api.github.com/users/daxian-dbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daxian-dbw/subscriptions","organizations_url":"https://api.github.com/users/daxian-dbw/orgs","repos_url":"https://api.github.com/users/daxian-dbw/repos","events_url":"https://api.github.com/users/daxian-dbw/events{/privacy}","received_events_url":"https://api.github.com/users/daxian-dbw/received_events","type":"User","site_admin":false},"html_url":"https://github.com/daxian-dbw/PSReadLine","description":"A bash inspired readline implementation for PowerShell","fork":true,"url":"https://api.github.com/repos/daxian-dbw/PSReadLine","forks_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/forks","keys_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/teams","hooks_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/hooks","issue_events_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/issues/events{/number}","events_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/events","assignees_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/assignees{/user}","branches_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/branches{/branch}","tags_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/tags","blobs_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/git/refs{/sha}","trees_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/statuses/{sha}","languages_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/languages","stargazers_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/stargazers","contributors_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/contributors","subscribers_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/subscribers","subscription_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/subscription","commits_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/commits{/sha}","git_commits_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/git/commits{/sha}","comments_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/comments{/number}","issue_comment_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/issues/comments{/number}","contents_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/contents/{+path}","compare_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/merges","archive_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/downloads","issues_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/issues{/number}","pulls_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/pulls{/number}","milestones_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/milestones{/number}","notifications_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/labels{/name}","releases_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/releases{/id}","deployments_url":"https://api.github.com/repos/daxian-dbw/PSReadLine/deployments","created_at":"2018-01-19T00:59:44Z","updated_at":"2018-01-19T00:59:46Z","pushed_at":"2018-11-26T17:28:53Z","git_url":"git://github.com/daxian-dbw/PSReadLine.git","ssh_url":"git@github.com:daxian-dbw/PSReadLine.git","clone_url":"https://github.com/daxian-dbw/PSReadLine.git","svn_url":"https://github.com/daxian-dbw/PSReadLine","homepage":"","size":1992,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lzybkr:master","ref":"master","sha":"d7da9d395ce2543e67b1ba95482ee45cf39c5586","user":{"login":"lzybkr","id":2148248,"node_id":"MDQ6VXNlcjIxNDgyNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/2148248?v=4","gravatar_id":"","url":"https://api.github.com/users/lzybkr","html_url":"https://github.com/lzybkr","followers_url":"https://api.github.com/users/lzybkr/followers","following_url":"https://api.github.com/users/lzybkr/following{/other_user}","gists_url":"https://api.github.com/users/lzybkr/gists{/gist_id}","starred_url":"https://api.github.com/users/lzybkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzybkr/subscriptions","organizations_url":"https://api.github.com/users/lzybkr/orgs","repos_url":"https://api.github.com/users/lzybkr/repos","events_url":"https://api.github.com/users/lzybkr/events{/privacy}","received_events_url":"https://api.github.com/users/lzybkr/received_events","type":"User","site_admin":false},"repo":{"id":10025737,"node_id":"MDEwOlJlcG9zaXRvcnkxMDAyNTczNw==","name":"PSReadLine","full_name":"lzybkr/PSReadLine","private":false,"owner":{"login":"lzybkr","id":2148248,"node_id":"MDQ6VXNlcjIxNDgyNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/2148248?v=4","gravatar_id":"","url":"https://api.github.com/users/lzybkr","html_url":"https://github.com/lzybkr","followers_url":"https://api.github.com/users/lzybkr/followers","following_url":"https://api.github.com/users/lzybkr/following{/other_user}","gists_url":"https://api.github.com/users/lzybkr/gists{/gist_id}","starred_url":"https://api.github.com/users/lzybkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzybkr/subscriptions","organizations_url":"https://api.github.com/users/lzybkr/orgs","repos_url":"https://api.github.com/users/lzybkr/repos","events_url":"https://api.github.com/users/lzybkr/events{/privacy}","received_events_url":"https://api.github.com/users/lzybkr/received_events","type":"User","site_admin":false},"html_url":"https://github.com/lzybkr/PSReadLine","description":"A bash inspired readline implementation for PowerShell","fork":false,"url":"https://api.github.com/repos/lzybkr/PSReadLine","forks_url":"https://api.github.com/repos/lzybkr/PSReadLine/forks","keys_url":"https://api.github.com/repos/lzybkr/PSReadLine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lzybkr/PSReadLine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lzybkr/PSReadLine/teams","hooks_url":"https://api.github.com/repos/lzybkr/PSReadLine/hooks","issue_events_url":"https://api.github.com/repos/lzybkr/PSReadLine/issues/events{/number}","events_url":"https://api.github.com/repos/lzybkr/PSReadLine/events","assignees_url":"https://api.github.com/repos/lzybkr/PSReadLine/assignees{/user}","branches_url":"https://api.github.com/repos/lzybkr/PSReadLine/branches{/branch}","tags_url":"https://api.github.com/repos/lzybkr/PSReadLine/tags","blobs_url":"https://api.github.com/repos/lzybkr/PSReadLine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lzybkr/PSReadLine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lzybkr/PSReadLine/git/refs{/sha}","trees_url":"https://api.github.com/repos/lzybkr/PSReadLine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lzybkr/PSReadLine/statuses/{sha}","languages_url":"https://api.github.com/repos/lzybkr/PSReadLine/languages","stargazers_url":"https://api.github.com/repos/lzybkr/PSReadLine/stargazers","contributors_url":"https://api.github.com/repos/lzybkr/PSReadLine/contributors","subscribers_url":"https://api.github.com/repos/lzybkr/PSReadLine/subscribers","subscription_url":"https://api.github.com/repos/lzybkr/PSReadLine/subscription","commits_url":"https://api.github.com/repos/lzybkr/PSReadLine/commits{/sha}","git_commits_url":"https://api.github.com/repos/lzybkr/PSReadLine/git/commits{/sha}","comments_url":"https://api.github.com/repos/lzybkr/PSReadLine/comments{/number}","issue_comment_url":"https://api.github.com/repos/lzybkr/PSReadLine/issues/comments{/number}","contents_url":"https://api.github.com/repos/lzybkr/PSReadLine/contents/{+path}","compare_url":"https://api.github.com/repos/lzybkr/PSReadLine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lzybkr/PSReadLine/merges","archive_url":"https://api.github.com/repos/lzybkr/PSReadLine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lzybkr/PSReadLine/downloads","issues_url":"https://api.github.com/repos/lzybkr/PSReadLine/issues{/number}","pulls_url":"https://api.github.com/repos/lzybkr/PSReadLine/pulls{/number}","milestones_url":"https://api.github.com/repos/lzybkr/PSReadLine/milestones{/number}","notifications_url":"https://api.github.com/repos/lzybkr/PSReadLine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lzybkr/PSReadLine/labels{/name}","releases_url":"https://api.github.com/repos/lzybkr/PSReadLine/releases{/id}","deployments_url":"https://api.github.com/repos/lzybkr/PSReadLine/deployments","created_at":"2013-05-13T06:39:28Z","updated_at":"2018-11-22T01:40:54Z","pushed_at":"2018-11-26T18:46:24Z","git_url":"git://github.com/lzybkr/PSReadLine.git","ssh_url":"git@github.com:lzybkr/PSReadLine.git","clone_url":"https://github.com/lzybkr/PSReadLine.git","svn_url":"https://github.com/lzybkr/PSReadLine","homepage":"","size":1975,"stargazers_count":1138,"watchers_count":1138,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":120,"mirror_url":null,"archived":false,"open_issues_count":117,"license":null,"forks":120,"open_issues":117,"watchers":1138,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/814"},"html":{"href":"https://github.com/lzybkr/PSReadLine/pull/814"},"issue":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/issues/814"},"comments":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/issues/814/comments"},"review_comments":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/814/comments"},"review_comment":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/pulls/814/commits"},"statuses":{"href":"https://api.github.com/repos/lzybkr/PSReadLine/statuses/c686c4745bb37ce522277723de0d8a5652b05333"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"lzybkr","id":2148248,"node_id":"MDQ6VXNlcjIxNDgyNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/2148248?v=4","gravatar_id":"","url":"https://api.github.com/users/lzybkr","html_url":"https://github.com/lzybkr","followers_url":"https://api.github.com/users/lzybkr/followers","following_url":"https://api.github.com/users/lzybkr/following{/other_user}","gists_url":"https://api.github.com/users/lzybkr/gists{/gist_id}","starred_url":"https://api.github.com/users/lzybkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzybkr/subscriptions","organizations_url":"https://api.github.com/users/lzybkr/orgs","repos_url":"https://api.github.com/users/lzybkr/repos","events_url":"https://api.github.com/users/lzybkr/events{/privacy}","received_events_url":"https://api.github.com/users/lzybkr/received_events","type":"User","site_admin":false},"comments":2,"review_comments":4,"maintainer_can_modify":false,"commits":3,"additions":4,"deletions":7,"changed_files":1}}
{"actor":{"display_login":"lzybkr"}}