{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/7396","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/7396/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/7396/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/7396/events","html_url":"https://github.com/dotnet/roslyn/issues/7396","id":121529035,"number":7396,"title":"[VS Crash] CSharpAddImportCodeFixProvider encountered an error and has been disabled.","user":{"login":"marked23","id":732793,"avatar_url":"https://avatars.githubusercontent.com/u/732793?v=3","gravatar_id":"","url":"https://api.github.com/users/marked23","html_url":"https://github.com/marked23","followers_url":"https://api.github.com/users/marked23/followers","following_url":"https://api.github.com/users/marked23/following{/other_user}","gists_url":"https://api.github.com/users/marked23/gists{/gist_id}","starred_url":"https://api.github.com/users/marked23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marked23/subscriptions","organizations_url":"https://api.github.com/users/marked23/orgs","repos_url":"https://api.github.com/users/marked23/repos","events_url":"https://api.github.com/users/marked23/events{/privacy}","received_events_url":"https://api.github.com/users/marked23/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/3%20-%20Working","name":"3 - Working","color":"CCCCCC"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Compilers","name":"Area-Compilers","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Need%20More%20Info","name":"Need More Info","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"AlekseyTs","id":10522107,"avatar_url":"https://avatars.githubusercontent.com/u/10522107?v=3","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/4","html_url":"https://github.com/dotnet/roslyn/milestones/1.2","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/4/labels","id":937402,"number":4,"title":"1.2","description":"This is our 1.2 Milestone.\r\n\r\n<!---\r\n@huboard:{\"order\":2.0}\r\n-->\r\n","creator":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"open_issues":601,"closed_issues":366,"state":"open","created_at":"2015-01-15T20:48:55Z","updated_at":"2016-01-19T19:23:26Z","due_on":null,"closed_at":null},"comments":21,"created_at":"2015-12-10T16:44:48Z","updated_at":"2016-01-19T19:30:06Z","closed_at":null,"body":"I get this warning at the top of the screen in VS 2015 Pro (RTM, and now also Update 1):\r\n\r\n'CSharpAddImportCodeFixProvider' encountered an error and has been disabled.\r\n\r\nThis is a frequent harbinger of an imminent IDE crash.  However, not all IDE crashes are preceded by these warnings. \r\n\r\nI'm usually typing new code and a dot that would normally show an intellisense pop-up will cause this.  Also happens when pasting code.  Also happens when adjusting curly braces.\r\n\r\nMy solution has bad namespace hygiene.  I think that's related to the problem, and can make this difficult to repro outside of my solution."},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/172960035","html_url":"https://github.com/dotnet/roslyn/issues/7396#issuecomment-172960035","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/7396","id":172960035,"user":{"login":"AlekseyTs","id":10522107,"avatar_url":"https://avatars.githubusercontent.com/u/10522107?v=3","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T19:30:06Z","updated_at":"2016-01-19T19:30:06Z","body":"Given that we don't have a reliable repro, I am going to assume that the source of the problem is an obfuscation of namespace names that mangles them in a way that violates CLR naming rules. The following test case gives an example.\r\n```\r\n        [Fact]\r\n        public void Test()\r\n        {\r\n            var result = new ArrayBuilder<IGrouping<string, System.Reflection.Metadata.TypeDefinitionHandle>>();\r\n\r\n            foreach (var namespaceName in new[] { \"A.\", \"A.a\", \"A..\", \"A.-\" })\r\n            {\r\n                result.Add(new Grouping<string, System.Reflection.Metadata.TypeDefinitionHandle>(namespaceName, \r\n                    Roslyn.Utilities.SpecializedCollections.EmptyEnumerable<System.Reflection.Metadata.TypeDefinitionHandle>()));\r\n            }\r\n\r\n            result.Sort(new PEModule.TypesByNamespaceSortComparer(StringComparer.Ordinal));\r\n\r\n            // This is equivalent to the result of PEModule.GroupTypesByNamespaceOrThrow\r\n            System.Collections.Generic.IEnumerable<IGrouping<string, System.Reflection.Metadata.TypeDefinitionHandle>> typesByNS = result;\r\n\r\n            // The following code is equivalent to code in PENamespaceSymbol.LoadAllMembers\r\n\r\n            System.Collections.Generic.IEnumerable<IGrouping<string, System.Reflection.Metadata.TypeDefinitionHandle>> nestedTypes = null;\r\n            System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, System.Collections.Generic.IEnumerable<IGrouping<string, System.Reflection.Metadata.TypeDefinitionHandle>>>> nestedNamespaces = null;\r\n\r\n            MetadataHelpers.GetInfoForImmediateNamespaceMembers(\r\n                \"A\".Length,\r\n                typesByNS,\r\n                StringComparer.Ordinal,\r\n                out nestedTypes, out nestedNamespaces);\r\n\r\n            // We don't expect duplicate keys in nestedNamespaces at this point.\r\n            Assert.False(nestedNamespaces.GroupBy(pair => pair.Key).Where(g => g.Count() > 1).Any());\r\n        }\r\n```\r\n\r\nI am going to address this particular scenario and then @rvrn22 and @marked23 could try if that addresses their scenario."}}