{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/poshtools/pulls/comments/36339251","id":36339251,"diff_hunk":"@@ -145,28 +147,47 @@ private void InitializeRunspace(PSHost psHost)\n             _runspace = RunspaceFactory.CreateRunspace(psHost, iss);\r\n             _runspace.Open();\r\n \r\n-            LoadProfile();\r\n+            ProvideProfileVariable();\r\n+            LoadProfiles();\r\n             ServiceCommon.Log(\"Done initializing runspace\");\r\n         }\r\n \r\n-        private void LoadProfile()\r\n+        private void LoadProfiles()\r\n         {\r\n-            ServiceCommon.Log(\"Loading PowerShell Profile\");\r\n+            if (_callback == null)\r\n+            {\r\n+                _callback = OperationContext.Current.GetCallbackChannel<IDebugEngineCallback>();\r\n+            }\r\n+\r\n+            if (!_callback.ShouldLoadProfiles())\r\n+            {\r\n+                return;\r\n+            }\r\n+\r\n+            ServiceCommon.Log(\"Loading PowerShell Profiles\");\r\n             using (PowerShell ps = PowerShell.Create())\r\n             {\r\n-                var myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);\r\n-                var windowsPowerShell = Path.Combine(myDocuments, \"WindowsPowerShell\");\r\n-                var profile = Path.Combine(windowsPowerShell, \"PoshTools_profile.ps1\");\r\n+                ps.Runspace = _runspace;\r\n \r\n-                var fi = new FileInfo(profile);\r\n-                if (!fi.Exists)\r\n+                PSObject profiles = _runspace.SessionStateProxy.PSVariable.Get(\"profile\").Value as PSObject;\r\n+                foreach(PSMemberInfo member in profiles.Members)\r","path":"PowerShellTools.HostService/ServiceManagement/Debugging/PowershellDebuggingServiceUtilities.cs","position":51,"original_position":51,"commit_id":"52525e52adffbbbd820396e1984caf6158ec74a7","original_commit_id":"52525e52adffbbbd820396e1984caf6158ec74a7","user":{"login":"MrayerMSFT","id":12631548,"avatar_url":"https://avatars.githubusercontent.com/u/12631548?v=3","gravatar_id":"","url":"https://api.github.com/users/MrayerMSFT","html_url":"https://github.com/MrayerMSFT","followers_url":"https://api.github.com/users/MrayerMSFT/followers","following_url":"https://api.github.com/users/MrayerMSFT/following{/other_user}","gists_url":"https://api.github.com/users/MrayerMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/MrayerMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrayerMSFT/subscriptions","organizations_url":"https://api.github.com/users/MrayerMSFT/orgs","repos_url":"https://api.github.com/users/MrayerMSFT/repos","events_url":"https://api.github.com/users/MrayerMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/MrayerMSFT/received_events","type":"User","site_admin":false},"body":"Roger wilco.","created_at":"2015-08-05T18:49:06Z","updated_at":"2015-08-05T18:49:06Z","html_url":"https://github.com/Microsoft/poshtools/pull/687#discussion_r36339251","pull_request_url":"https://api.github.com/repos/Microsoft/poshtools/pulls/687","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/poshtools/pulls/comments/36339251"},"html":{"href":"https://github.com/Microsoft/poshtools/pull/687#discussion_r36339251"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/poshtools/pulls/687"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/poshtools/pulls/687","id":41632574,"html_url":"https://github.com/Microsoft/poshtools/pull/687","diff_url":"https://github.com/Microsoft/poshtools/pull/687.diff","patch_url":"https://github.com/Microsoft/poshtools/pull/687.patch","issue_url":"https://api.github.com/repos/Microsoft/poshtools/issues/687","number":687,"state":"open","locked":false,"title":"Implement $profile Variable & Profile Loading","user":{"login":"MrayerMSFT","id":12631548,"avatar_url":"https://avatars.githubusercontent.com/u/12631548?v=3","gravatar_id":"","url":"https://api.github.com/users/MrayerMSFT","html_url":"https://github.com/MrayerMSFT","followers_url":"https://api.github.com/users/MrayerMSFT/followers","following_url":"https://api.github.com/users/MrayerMSFT/following{/other_user}","gists_url":"https://api.github.com/users/MrayerMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/MrayerMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrayerMSFT/subscriptions","organizations_url":"https://api.github.com/users/MrayerMSFT/orgs","repos_url":"https://api.github.com/users/MrayerMSFT/repos","events_url":"https://api.github.com/users/MrayerMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/MrayerMSFT/received_events","type":"User","site_admin":false},"body":"Adds a $profile variable to our host. Values are taken from [here] (https://github.com/Microsoft/poshtools/issues/291#issuecomment-86224275). Each profile is then loaded when we initialize our runspace. \r\n\r\nResolves #291 \r\n\r\n@AndreSayreMSFT  @HuanhuanSunMSFT ","created_at":"2015-08-05T00:26:28Z","updated_at":"2015-08-05T18:49:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f08fd544f82e8904194873fa3c5c0b9bb203d3a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/poshtools/pulls/687/commits","review_comments_url":"https://api.github.com/repos/Microsoft/poshtools/pulls/687/comments","review_comment_url":"https://api.github.com/repos/Microsoft/poshtools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/poshtools/issues/687/comments","statuses_url":"https://api.github.com/repos/Microsoft/poshtools/statuses/52525e52adffbbbd820396e1984caf6158ec74a7","head":{"label":"Microsoft:implement-$profile","ref":"implement-$profile","sha":"52525e52adffbbbd820396e1984caf6158ec74a7","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":27854486,"name":"poshtools","full_name":"Microsoft/poshtools","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/poshtools","description":"PowerShell integration for Visual Studio","fork":true,"url":"https://api.github.com/repos/Microsoft/poshtools","forks_url":"https://api.github.com/repos/Microsoft/poshtools/forks","keys_url":"https://api.github.com/repos/Microsoft/poshtools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/poshtools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/poshtools/teams","hooks_url":"https://api.github.com/repos/Microsoft/poshtools/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/poshtools/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/poshtools/events","assignees_url":"https://api.github.com/repos/Microsoft/poshtools/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/poshtools/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/poshtools/tags","blobs_url":"https://api.github.com/repos/Microsoft/poshtools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/poshtools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/poshtools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/poshtools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/poshtools/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/poshtools/languages","stargazers_url":"https://api.github.com/repos/Microsoft/poshtools/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/poshtools/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/poshtools/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/poshtools/subscription","commits_url":"https://api.github.com/repos/Microsoft/poshtools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/poshtools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/poshtools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/poshtools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/poshtools/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/poshtools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/poshtools/merges","archive_url":"https://api.github.com/repos/Microsoft/poshtools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/poshtools/downloads","issues_url":"https://api.github.com/repos/Microsoft/poshtools/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/poshtools/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/poshtools/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/poshtools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/poshtools/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/poshtools/releases{/id}","created_at":"2014-12-11T04:44:03Z","updated_at":"2015-07-24T10:41:06Z","pushed_at":"2015-08-05T17:56:01Z","git_url":"git://github.com/Microsoft/poshtools.git","ssh_url":"git@github.com:Microsoft/poshtools.git","clone_url":"https://github.com/Microsoft/poshtools.git","svn_url":"https://github.com/Microsoft/poshtools","homepage":"http://www.visualstudio.com/","size":12682,"stargazers_count":110,"watchers_count":110,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":12,"mirror_url":null,"open_issues_count":142,"forks":12,"open_issues":142,"watchers":110,"default_branch":"dev"}},"base":{"label":"Microsoft:dev","ref":"dev","sha":"b926d390145ca3c260580a1b1ab6509849ab977b","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":27854486,"name":"poshtools","full_name":"Microsoft/poshtools","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/poshtools","description":"PowerShell integration for Visual Studio","fork":true,"url":"https://api.github.com/repos/Microsoft/poshtools","forks_url":"https://api.github.com/repos/Microsoft/poshtools/forks","keys_url":"https://api.github.com/repos/Microsoft/poshtools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/poshtools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/poshtools/teams","hooks_url":"https://api.github.com/repos/Microsoft/poshtools/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/poshtools/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/poshtools/events","assignees_url":"https://api.github.com/repos/Microsoft/poshtools/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/poshtools/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/poshtools/tags","blobs_url":"https://api.github.com/repos/Microsoft/poshtools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/poshtools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/poshtools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/poshtools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/poshtools/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/poshtools/languages","stargazers_url":"https://api.github.com/repos/Microsoft/poshtools/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/poshtools/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/poshtools/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/poshtools/subscription","commits_url":"https://api.github.com/repos/Microsoft/poshtools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/poshtools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/poshtools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/poshtools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/poshtools/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/poshtools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/poshtools/merges","archive_url":"https://api.github.com/repos/Microsoft/poshtools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/poshtools/downloads","issues_url":"https://api.github.com/repos/Microsoft/poshtools/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/poshtools/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/poshtools/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/poshtools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/poshtools/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/poshtools/releases{/id}","created_at":"2014-12-11T04:44:03Z","updated_at":"2015-07-24T10:41:06Z","pushed_at":"2015-08-05T17:56:01Z","git_url":"git://github.com/Microsoft/poshtools.git","ssh_url":"git@github.com:Microsoft/poshtools.git","clone_url":"https://github.com/Microsoft/poshtools.git","svn_url":"https://github.com/Microsoft/poshtools","homepage":"http://www.visualstudio.com/","size":12682,"stargazers_count":110,"watchers_count":110,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":12,"mirror_url":null,"open_issues_count":142,"forks":12,"open_issues":142,"watchers":110,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/poshtools/pulls/687"},"html":{"href":"https://github.com/Microsoft/poshtools/pull/687"},"issue":{"href":"https://api.github.com/repos/Microsoft/poshtools/issues/687"},"comments":{"href":"https://api.github.com/repos/Microsoft/poshtools/issues/687/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/poshtools/pulls/687/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/poshtools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/poshtools/pulls/687/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/poshtools/statuses/52525e52adffbbbd820396e1984caf6158ec74a7"}}}}