{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/comments/77871743","id":77871743,"diff_hunk":"@@ -0,0 +1,173 @@\n+﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.\n+\n+using System;\n+using System.ComponentModel.Composition;\n+using System.Threading.Tasks.Dataflow;\n+using Microsoft.VisualStudio.ProjectSystem.Debug;\n+using Microsoft.VisualStudio.ProjectSystem.Utilities.DataFlowExtensions;\n+using Microsoft.VisualStudio.Shell;\n+using Microsoft.VisualStudio.Shell.Interop;\n+using Tasks = System.Threading.Tasks;\n+\n+namespace Microsoft.VisualStudio.ProjectSystem.VS.Debug\n+{\n+    /// <summary>\n+    /// <see cref=\"StartupProjectRegistrar\"/> is responsible for adding or removing a project from the Startup list\n+    /// depending on whether the active configuration of the a project is debuggable or not.\n+    /// </summary>\n+    internal class StartupProjectRegistrar :\n+        IDisposable\n+    {\n+        private readonly IVsStartupProjectsListService _startupProjectsListService;\n+        private readonly IUnconfiguredProjectVsServices _projectVsServices;\n+        private readonly IProjectThreadingService _threadingService;\n+        private readonly IActiveConfiguredProjectSubscriptionService _activeConfiguredProjectSubscriptionService;\n+        private readonly ActiveConfiguredProject<DebuggerLaunchProviders> _launchProviders;\n+\n+        private Guid _guid;\n+        private IDisposable _evaluationSubscriptionLink;\n+        private bool _isDebuggable;\n+\n+        internal DataFlowExtensionMethodCaller WrapperMethodCaller { get; set; }\n+\n+        [ImportingConstructor]\n+        public StartupProjectRegistrar(\n+            IUnconfiguredProjectVsServices projectVsServices,\n+            SVsServiceProvider serviceProvider,\n+            IProjectThreadingService threadingService,\n+            IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService,\n+            ActiveConfiguredProject<DebuggerLaunchProviders> launchProviders)\n+        {\n+            Requires.NotNull(projectVsServices, nameof(projectVsServices));\n+            Requires.NotNull(serviceProvider, nameof(serviceProvider));\n+            Requires.NotNull(threadingService, nameof(threadingService));\n+            Requires.NotNull(activeConfiguredProjectSubscriptionService, nameof(activeConfiguredProjectSubscriptionService));\n+            Requires.NotNull(launchProviders, nameof(launchProviders));\n+\n+            _projectVsServices = projectVsServices;\n+            _startupProjectsListService = serviceProvider.GetService<IVsStartupProjectsListService, SVsStartupProjectsListService>();\n+            _threadingService = threadingService;\n+            _activeConfiguredProjectSubscriptionService = activeConfiguredProjectSubscriptionService;\n+            _launchProviders = launchProviders;\n+\n+            WrapperMethodCaller = new DataFlowExtensionMethodCaller(new DataFlowExtensionMethodWrapper());\n+        }\n+\n+        [ProjectAutoLoad]\n+        [AppliesTo(ProjectCapability.CSharpOrVisualBasic)]\n+        internal async Tasks.Task OnProjectFactoryCompletedAsync()\n+        {\n+            ConfigurationGeneral projectProperties =\n+                await _projectVsServices.ActiveConfiguredProjectProperties.GetConfigurationGeneralPropertiesAsync().ConfigureAwait(false);\n+            _guid = new Guid((string)await projectProperties.ProjectGuid.GetValueAsync().ConfigureAwait(false));\n+            Assumes.False(_guid == Guid.Empty);\n+\n+            await InitializeAsync().ConfigureAwait(false);\n+        }\n+\n+        public async Tasks.Task InitializeAsync()\n+        {\n+            await AddOrRemoveProjectFromStartupProjectList(initialize: true).ConfigureAwait(false);\n+\n+            var watchedEvaluationRules = Empty.OrdinalIgnoreCaseStringSet.Add(ConfigurationGeneral.SchemaName);\n+            var evaluationBlock = new ActionBlock<IProjectVersionedValue<IProjectSubscriptionUpdate>>(\n+                ConfigurationGeneralRuleBlock_ChangedAsync);\n+            IReceivableSourceBlock<IProjectVersionedValue<IProjectSubscriptionUpdate>> sourceBlock = \n+                _activeConfiguredProjectSubscriptionService.ProjectRuleSource.SourceBlock;\n+            _evaluationSubscriptionLink = WrapperMethodCaller.LinkTo(\n+                sourceBlock,\n+                evaluationBlock,\n+                ruleNames: watchedEvaluationRules, suppressVersionOnlyUpdates:true\n+                );\n+        }\n+\n+        internal async Tasks.Task ConfigurationGeneralRuleBlock_ChangedAsync(IProjectVersionedValue<IProjectSubscriptionUpdate> e)\n+        {\n+            IProjectChangeDescription projectChange = e.Value.ProjectChanges[ConfigurationGeneral.SchemaName];\n+\n+            /* Currently  we watch for the change in the OutputType to check if a project is debuggable.\n+               There are other cases where the OutputType will remain the same and still the ability to debuggable a project could change\n+               For eg: A project's OutputType could be a Lib and an execution entry point could be added or removed\n+               */\n+            if (projectChange.Difference.ChangedProperties.Contains(ConfigurationGeneral.OutputTypeProperty))","path":"src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Debug/StartupProjectRegistrar.cs","position":105,"original_position":92,"commit_id":"5cb8eecde2df2b281bc5dcbd504b21a63717da59","original_commit_id":"77dfab85625043b81f0c9d3f5d95ef21b50a6c93","user":{"login":"333fred","id":2371880,"avatar_url":"https://avatars.githubusercontent.com/u/2371880?v=3","gravatar_id":"","url":"https://api.github.com/users/333fred","html_url":"https://github.com/333fred","followers_url":"https://api.github.com/users/333fred/followers","following_url":"https://api.github.com/users/333fred/following{/other_user}","gists_url":"https://api.github.com/users/333fred/gists{/gist_id}","starred_url":"https://api.github.com/users/333fred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/333fred/subscriptions","organizations_url":"https://api.github.com/users/333fred/orgs","repos_url":"https://api.github.com/users/333fred/repos","events_url":"https://api.github.com/users/333fred/events{/privacy}","received_events_url":"https://api.github.com/users/333fred/received_events","type":"User","site_admin":false},"body":"Can you please link it in the comment?","created_at":"2016-09-07T17:49:32Z","updated_at":"2016-09-07T17:49:32Z","html_url":"https://github.com/dotnet/roslyn-project-system/pull/426#discussion_r77871743","pull_request_url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/comments/77871743"},"html":{"href":"https://github.com/dotnet/roslyn-project-system/pull/426#discussion_r77871743"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426","id":83397340,"html_url":"https://github.com/dotnet/roslyn-project-system/pull/426","diff_url":"https://github.com/dotnet/roslyn-project-system/pull/426.diff","patch_url":"https://github.com/dotnet/roslyn-project-system/pull/426.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn-project-system/issues/426","number":426,"state":"open","locked":false,"title":"Add StartupProjectRegistrar which adds/removes projects from IVsStartupProjectsListService","user":{"login":"basoundr","id":10550513,"avatar_url":"https://avatars.githubusercontent.com/u/10550513?v=3","gravatar_id":"","url":"https://api.github.com/users/basoundr","html_url":"https://github.com/basoundr","followers_url":"https://api.github.com/users/basoundr/followers","following_url":"https://api.github.com/users/basoundr/following{/other_user}","gists_url":"https://api.github.com/users/basoundr/gists{/gist_id}","starred_url":"https://api.github.com/users/basoundr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basoundr/subscriptions","organizations_url":"https://api.github.com/users/basoundr/orgs","repos_url":"https://api.github.com/users/basoundr/repos","events_url":"https://api.github.com/users/basoundr/events{/privacy}","received_events_url":"https://api.github.com/users/basoundr/received_events","type":"User","site_admin":false},"body":"Tagging @dotnet/project-system for review","created_at":"2016-08-31T06:49:39Z","updated_at":"2016-09-07T17:49:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe71ecf76b2dfc0125a583ab2af0d9b973298b53","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn-project-system/issues/426/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn-project-system/statuses/5cb8eecde2df2b281bc5dcbd504b21a63717da59","head":{"label":"basoundr:StartupListService","ref":"StartupListService","sha":"5cb8eecde2df2b281bc5dcbd504b21a63717da59","user":{"login":"basoundr","id":10550513,"avatar_url":"https://avatars.githubusercontent.com/u/10550513?v=3","gravatar_id":"","url":"https://api.github.com/users/basoundr","html_url":"https://github.com/basoundr","followers_url":"https://api.github.com/users/basoundr/followers","following_url":"https://api.github.com/users/basoundr/following{/other_user}","gists_url":"https://api.github.com/users/basoundr/gists{/gist_id}","starred_url":"https://api.github.com/users/basoundr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basoundr/subscriptions","organizations_url":"https://api.github.com/users/basoundr/orgs","repos_url":"https://api.github.com/users/basoundr/repos","events_url":"https://api.github.com/users/basoundr/events{/privacy}","received_events_url":"https://api.github.com/users/basoundr/received_events","type":"User","site_admin":false},"repo":{"id":58071639,"name":"roslyn-project-system","full_name":"basoundr/roslyn-project-system","owner":{"login":"basoundr","id":10550513,"avatar_url":"https://avatars.githubusercontent.com/u/10550513?v=3","gravatar_id":"","url":"https://api.github.com/users/basoundr","html_url":"https://github.com/basoundr","followers_url":"https://api.github.com/users/basoundr/followers","following_url":"https://api.github.com/users/basoundr/following{/other_user}","gists_url":"https://api.github.com/users/basoundr/gists{/gist_id}","starred_url":"https://api.github.com/users/basoundr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basoundr/subscriptions","organizations_url":"https://api.github.com/users/basoundr/orgs","repos_url":"https://api.github.com/users/basoundr/repos","events_url":"https://api.github.com/users/basoundr/events{/privacy}","received_events_url":"https://api.github.com/users/basoundr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/basoundr/roslyn-project-system","description":"The C# and Visual Basic project system for Visual Studio \"15\"","fork":true,"url":"https://api.github.com/repos/basoundr/roslyn-project-system","forks_url":"https://api.github.com/repos/basoundr/roslyn-project-system/forks","keys_url":"https://api.github.com/repos/basoundr/roslyn-project-system/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basoundr/roslyn-project-system/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basoundr/roslyn-project-system/teams","hooks_url":"https://api.github.com/repos/basoundr/roslyn-project-system/hooks","issue_events_url":"https://api.github.com/repos/basoundr/roslyn-project-system/issues/events{/number}","events_url":"https://api.github.com/repos/basoundr/roslyn-project-system/events","assignees_url":"https://api.github.com/repos/basoundr/roslyn-project-system/assignees{/user}","branches_url":"https://api.github.com/repos/basoundr/roslyn-project-system/branches{/branch}","tags_url":"https://api.github.com/repos/basoundr/roslyn-project-system/tags","blobs_url":"https://api.github.com/repos/basoundr/roslyn-project-system/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basoundr/roslyn-project-system/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basoundr/roslyn-project-system/git/refs{/sha}","trees_url":"https://api.github.com/repos/basoundr/roslyn-project-system/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basoundr/roslyn-project-system/statuses/{sha}","languages_url":"https://api.github.com/repos/basoundr/roslyn-project-system/languages","stargazers_url":"https://api.github.com/repos/basoundr/roslyn-project-system/stargazers","contributors_url":"https://api.github.com/repos/basoundr/roslyn-project-system/contributors","subscribers_url":"https://api.github.com/repos/basoundr/roslyn-project-system/subscribers","subscription_url":"https://api.github.com/repos/basoundr/roslyn-project-system/subscription","commits_url":"https://api.github.com/repos/basoundr/roslyn-project-system/commits{/sha}","git_commits_url":"https://api.github.com/repos/basoundr/roslyn-project-system/git/commits{/sha}","comments_url":"https://api.github.com/repos/basoundr/roslyn-project-system/comments{/number}","issue_comment_url":"https://api.github.com/repos/basoundr/roslyn-project-system/issues/comments{/number}","contents_url":"https://api.github.com/repos/basoundr/roslyn-project-system/contents/{+path}","compare_url":"https://api.github.com/repos/basoundr/roslyn-project-system/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basoundr/roslyn-project-system/merges","archive_url":"https://api.github.com/repos/basoundr/roslyn-project-system/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basoundr/roslyn-project-system/downloads","issues_url":"https://api.github.com/repos/basoundr/roslyn-project-system/issues{/number}","pulls_url":"https://api.github.com/repos/basoundr/roslyn-project-system/pulls{/number}","milestones_url":"https://api.github.com/repos/basoundr/roslyn-project-system/milestones{/number}","notifications_url":"https://api.github.com/repos/basoundr/roslyn-project-system/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basoundr/roslyn-project-system/labels{/name}","releases_url":"https://api.github.com/repos/basoundr/roslyn-project-system/releases{/id}","deployments_url":"https://api.github.com/repos/basoundr/roslyn-project-system/deployments","created_at":"2016-05-04T17:41:51Z","updated_at":"2016-05-04T17:41:53Z","pushed_at":"2016-09-07T17:29:59Z","git_url":"git://github.com/basoundr/roslyn-project-system.git","ssh_url":"git@github.com:basoundr/roslyn-project-system.git","clone_url":"https://github.com/basoundr/roslyn-project-system.git","svn_url":"https://github.com/basoundr/roslyn-project-system","homepage":null,"size":5681,"stargazers_count":0,"watchers_count":0,"language":"Visual Basic","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"847f62bed082e50a6f17dbf798be3d86b68542e9","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":56740275,"name":"roslyn-project-system","full_name":"dotnet/roslyn-project-system","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn-project-system","description":"The C# and Visual Basic project system for Visual Studio \"15\"","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn-project-system","forks_url":"https://api.github.com/repos/dotnet/roslyn-project-system/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn-project-system/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn-project-system/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn-project-system/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn-project-system/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn-project-system/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn-project-system/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn-project-system/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn-project-system/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn-project-system/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn-project-system/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn-project-system/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn-project-system/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn-project-system/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn-project-system/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn-project-system/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn-project-system/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn-project-system/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn-project-system/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn-project-system/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn-project-system/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn-project-system/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn-project-system/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn-project-system/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn-project-system/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn-project-system/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn-project-system/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn-project-system/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn-project-system/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn-project-system/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn-project-system/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn-project-system/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn-project-system/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn-project-system/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn-project-system/deployments","created_at":"2016-04-21T03:40:18Z","updated_at":"2016-09-03T08:02:18Z","pushed_at":"2016-09-07T17:39:23Z","git_url":"git://github.com/dotnet/roslyn-project-system.git","ssh_url":"git@github.com:dotnet/roslyn-project-system.git","clone_url":"https://github.com/dotnet/roslyn-project-system.git","svn_url":"https://github.com/dotnet/roslyn-project-system","homepage":null,"size":6070,"stargazers_count":150,"watchers_count":150,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":237,"forks":34,"open_issues":237,"watchers":150,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426"},"html":{"href":"https://github.com/dotnet/roslyn-project-system/pull/426"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/issues/426"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/issues/426/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/pulls/426/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn-project-system/statuses/5cb8eecde2df2b281bc5dcbd504b21a63717da59"}}}}
{"actor":{"display_login":"333fred"}}