{"action":"created","comment":{"url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/comments/35120786","id":35120786,"diff_hunk":"@@ -34,19 +35,51 @@ public class SafeDirectoryCatalog : ComposablePartCatalog\n \n         public SafeDirectoryCatalog(string directory)\n         {\n-            var files = Directory.EnumerateFiles(directory, \"*.dll\", SearchOption.AllDirectories);\n-\n             _catalog = new AggregateCatalog();\n \n+            // ASP.NET will load all the DLL files under the bin folder; the first loop would be sufficient\n+            var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies()\n+                                            .Where(asm => asm.GetName().CodeBase.StartsWith(\"file://\"));\n+\n+            var processedFiles = new List<string>();\n+            foreach (var assembly in loadedAssemblies)\n+            {\n+                var fileUri = new Uri(assembly.GetName().CodeBase);\n+                var fi = new FileInfo(fileUri.AbsolutePath);\n+                if (fi.DirectoryName != null &&\n+                    fi.DirectoryName.StartsWith(directory, StringComparison.InvariantCultureIgnoreCase))\n+                {\n+                    try\n+                    {\n+                        processedFiles.Add(fi.FullName.ToUpper());\n+                        var asmCatalog = new AssemblyCatalog(assembly);\n+                        //Force MEF to load the plugin and figure out if there are any exports\n+                        // good assemblies will not throw the RTLE exception and can be added to the catalog\n+                        if (asmCatalog.Parts.ToList().Count > 0) _catalog.Catalogs.Add(asmCatalog);\n+                    }\n+                    catch (ReflectionTypeLoadException)\n+                    {\n+                    }\n+                    catch (BadImageFormatException)\n+                    {\n+                    }\n+                    catch (FileLoadException) //ignore when the assembly load failed.\n+                    {\n+                    }\n+                }\n+            }\n+\n+            // process whatever left in subfolders\n+            var files = Directory.EnumerateFiles(directory, \"*.dll\", SearchOption.AllDirectories)\n+                                 .Select(f => f.ToUpper()).Except(processedFiles);","path":"DNN Platform/Library/ExtensionPoints/SafeDirectoryCatalog.cs","position":50,"original_position":50,"commit_id":"49f0eece3931709fbe213c77bb5856d6527820ab","original_commit_id":"49f0eece3931709fbe213c77bb5856d6527820ab","user":{"login":"bdukes","id":59507,"avatar_url":"https://avatars.githubusercontent.com/u/59507?v=3","gravatar_id":"","url":"https://api.github.com/users/bdukes","html_url":"https://github.com/bdukes","followers_url":"https://api.github.com/users/bdukes/followers","following_url":"https://api.github.com/users/bdukes/following{/other_user}","gists_url":"https://api.github.com/users/bdukes/gists{/gist_id}","starred_url":"https://api.github.com/users/bdukes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdukes/subscriptions","organizations_url":"https://api.github.com/users/bdukes/orgs","repos_url":"https://api.github.com/users/bdukes/repos","events_url":"https://api.github.com/users/bdukes/events{/privacy}","received_events_url":"https://api.github.com/users/bdukes/received_events","type":"User","site_admin":false},"body":"This should use the `Except` overload that takes a `IEqualityComparer<string>` (https://msdn.microsoft.com/en-us/library/vstudio/bb336390.aspx), passing `StringComparer.OrdinalIgnoreCase`, rather than converting each file path to upper case","created_at":"2015-07-21T16:08:55Z","updated_at":"2015-07-21T16:08:55Z","html_url":"https://github.com/dnnsoftware/Dnn.Platform/pull/652#discussion_r35120786","pull_request_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652","_links":{"self":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/comments/35120786"},"html":{"href":"https://github.com/dnnsoftware/Dnn.Platform/pull/652#discussion_r35120786"},"pull_request":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652"}}},"pull_request":{"url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652","id":40473543,"html_url":"https://github.com/dnnsoftware/Dnn.Platform/pull/652","diff_url":"https://github.com/dnnsoftware/Dnn.Platform/pull/652.diff","patch_url":"https://github.com/dnnsoftware/Dnn.Platform/pull/652.patch","issue_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/652","number":652,"state":"open","locked":false,"title":"DNN-7142: tweak for MEF for Event Model.","user":{"login":"galatrash-at-dnn","id":5115674,"avatar_url":"https://avatars.githubusercontent.com/u/5115674?v=3","gravatar_id":"","url":"https://api.github.com/users/galatrash-at-dnn","html_url":"https://github.com/galatrash-at-dnn","followers_url":"https://api.github.com/users/galatrash-at-dnn/followers","following_url":"https://api.github.com/users/galatrash-at-dnn/following{/other_user}","gists_url":"https://api.github.com/users/galatrash-at-dnn/gists{/gist_id}","starred_url":"https://api.github.com/users/galatrash-at-dnn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galatrash-at-dnn/subscriptions","organizations_url":"https://api.github.com/users/galatrash-at-dnn/orgs","repos_url":"https://api.github.com/users/galatrash-at-dnn/repos","events_url":"https://api.github.com/users/galatrash-at-dnn/events{/privacy}","received_events_url":"https://api.github.com/users/galatrash-at-dnn/received_events","type":"User","site_admin":false},"body":"This tweak saved about 10 seconds in the start-up time in our testing cloud environment.\r\n","created_at":"2015-07-21T15:56:05Z","updated_at":"2015-07-21T16:08:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fae5269b86af836b620933947c7058b40946b14","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652/commits","review_comments_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652/comments","review_comment_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/652/comments","statuses_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/statuses/49f0eece3931709fbe213c77bb5856d6527820ab","head":{"label":"dnnsoftware:research/speed-dnn-7142","ref":"research/speed-dnn-7142","sha":"49f0eece3931709fbe213c77bb5856d6527820ab","user":{"login":"dnnsoftware","id":5099054,"avatar_url":"https://avatars.githubusercontent.com/u/5099054?v=3","gravatar_id":"","url":"https://api.github.com/users/dnnsoftware","html_url":"https://github.com/dnnsoftware","followers_url":"https://api.github.com/users/dnnsoftware/followers","following_url":"https://api.github.com/users/dnnsoftware/following{/other_user}","gists_url":"https://api.github.com/users/dnnsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/dnnsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnnsoftware/subscriptions","organizations_url":"https://api.github.com/users/dnnsoftware/orgs","repos_url":"https://api.github.com/users/dnnsoftware/repos","events_url":"https://api.github.com/users/dnnsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/dnnsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":12095044,"name":"Dnn.Platform","full_name":"dnnsoftware/Dnn.Platform","owner":{"login":"dnnsoftware","id":5099054,"avatar_url":"https://avatars.githubusercontent.com/u/5099054?v=3","gravatar_id":"","url":"https://api.github.com/users/dnnsoftware","html_url":"https://github.com/dnnsoftware","followers_url":"https://api.github.com/users/dnnsoftware/followers","following_url":"https://api.github.com/users/dnnsoftware/following{/other_user}","gists_url":"https://api.github.com/users/dnnsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/dnnsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnnsoftware/subscriptions","organizations_url":"https://api.github.com/users/dnnsoftware/orgs","repos_url":"https://api.github.com/users/dnnsoftware/repos","events_url":"https://api.github.com/users/dnnsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/dnnsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dnnsoftware/Dnn.Platform","description":"DNN Corp Platform Repository.","fork":false,"url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform","forks_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/forks","keys_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/teams","hooks_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/hooks","issue_events_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/events{/number}","events_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/events","assignees_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/assignees{/user}","branches_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/branches{/branch}","tags_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/tags","blobs_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/statuses/{sha}","languages_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/languages","stargazers_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/stargazers","contributors_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/contributors","subscribers_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/subscribers","subscription_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/subscription","commits_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/contents/{+path}","compare_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/merges","archive_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/downloads","issues_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues{/number}","pulls_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls{/number}","milestones_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/milestones{/number}","notifications_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/labels{/name}","releases_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/releases{/id}","created_at":"2013-08-13T22:58:08Z","updated_at":"2015-07-18T08:48:38Z","pushed_at":"2015-07-21T15:56:05Z","git_url":"git://github.com/dnnsoftware/Dnn.Platform.git","ssh_url":"git@github.com:dnnsoftware/Dnn.Platform.git","clone_url":"https://github.com/dnnsoftware/Dnn.Platform.git","svn_url":"https://github.com/dnnsoftware/Dnn.Platform","homepage":null,"size":1096516,"stargazers_count":118,"watchers_count":118,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":154,"mirror_url":null,"open_issues_count":17,"forks":154,"open_issues":17,"watchers":118,"default_branch":"development"}},"base":{"label":"dnnsoftware:research/speed","ref":"research/speed","sha":"54745feeb9c1d85b21f37c9320a8839fee292cb7","user":{"login":"dnnsoftware","id":5099054,"avatar_url":"https://avatars.githubusercontent.com/u/5099054?v=3","gravatar_id":"","url":"https://api.github.com/users/dnnsoftware","html_url":"https://github.com/dnnsoftware","followers_url":"https://api.github.com/users/dnnsoftware/followers","following_url":"https://api.github.com/users/dnnsoftware/following{/other_user}","gists_url":"https://api.github.com/users/dnnsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/dnnsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnnsoftware/subscriptions","organizations_url":"https://api.github.com/users/dnnsoftware/orgs","repos_url":"https://api.github.com/users/dnnsoftware/repos","events_url":"https://api.github.com/users/dnnsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/dnnsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":12095044,"name":"Dnn.Platform","full_name":"dnnsoftware/Dnn.Platform","owner":{"login":"dnnsoftware","id":5099054,"avatar_url":"https://avatars.githubusercontent.com/u/5099054?v=3","gravatar_id":"","url":"https://api.github.com/users/dnnsoftware","html_url":"https://github.com/dnnsoftware","followers_url":"https://api.github.com/users/dnnsoftware/followers","following_url":"https://api.github.com/users/dnnsoftware/following{/other_user}","gists_url":"https://api.github.com/users/dnnsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/dnnsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnnsoftware/subscriptions","organizations_url":"https://api.github.com/users/dnnsoftware/orgs","repos_url":"https://api.github.com/users/dnnsoftware/repos","events_url":"https://api.github.com/users/dnnsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/dnnsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dnnsoftware/Dnn.Platform","description":"DNN Corp Platform Repository.","fork":false,"url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform","forks_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/forks","keys_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/teams","hooks_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/hooks","issue_events_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/events{/number}","events_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/events","assignees_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/assignees{/user}","branches_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/branches{/branch}","tags_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/tags","blobs_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/statuses/{sha}","languages_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/languages","stargazers_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/stargazers","contributors_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/contributors","subscribers_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/subscribers","subscription_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/subscription","commits_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/contents/{+path}","compare_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/merges","archive_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/downloads","issues_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues{/number}","pulls_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls{/number}","milestones_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/milestones{/number}","notifications_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/labels{/name}","releases_url":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/releases{/id}","created_at":"2013-08-13T22:58:08Z","updated_at":"2015-07-18T08:48:38Z","pushed_at":"2015-07-21T15:56:05Z","git_url":"git://github.com/dnnsoftware/Dnn.Platform.git","ssh_url":"git@github.com:dnnsoftware/Dnn.Platform.git","clone_url":"https://github.com/dnnsoftware/Dnn.Platform.git","svn_url":"https://github.com/dnnsoftware/Dnn.Platform","homepage":null,"size":1096516,"stargazers_count":118,"watchers_count":118,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":154,"mirror_url":null,"open_issues_count":17,"forks":154,"open_issues":17,"watchers":118,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652"},"html":{"href":"https://github.com/dnnsoftware/Dnn.Platform/pull/652"},"issue":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/652"},"comments":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/issues/652/comments"},"review_comments":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652/comments"},"review_comment":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/pulls/652/commits"},"statuses":{"href":"https://api.github.com/repos/dnnsoftware/Dnn.Platform/statuses/49f0eece3931709fbe213c77bb5856d6527820ab"}}}}