{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/4745","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/4745/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/4745/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/4745/events","html_url":"https://github.com/dotnet/roslyn/issues/4745","id":102688755,"number":4745,"title":"namespace declaration syntax node actions are called multiple times","user":{"login":"pdelvo","id":1710209,"avatar_url":"https://avatars.githubusercontent.com/u/1710209?v=3","gravatar_id":"","url":"https://api.github.com/users/pdelvo","html_url":"https://github.com/pdelvo","followers_url":"https://api.github.com/users/pdelvo/followers","following_url":"https://api.github.com/users/pdelvo/following{/other_user}","gists_url":"https://api.github.com/users/pdelvo/gists{/gist_id}","starred_url":"https://api.github.com/users/pdelvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdelvo/subscriptions","organizations_url":"https://api.github.com/users/pdelvo/orgs","repos_url":"https://api.github.com/users/pdelvo/repos","events_url":"https://api.github.com/users/pdelvo/events{/privacy}","received_events_url":"https://api.github.com/users/pdelvo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Analyzers","name":"Area-Analyzers","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Bug","name":"Bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"mavasani","id":10605811,"avatar_url":"https://avatars.githubusercontent.com/u/10605811?v=3","gravatar_id":"","url":"https://api.github.com/users/mavasani","html_url":"https://github.com/mavasani","followers_url":"https://api.github.com/users/mavasani/followers","following_url":"https://api.github.com/users/mavasani/following{/other_user}","gists_url":"https://api.github.com/users/mavasani/gists{/gist_id}","starred_url":"https://api.github.com/users/mavasani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavasani/subscriptions","organizations_url":"https://api.github.com/users/mavasani/orgs","repos_url":"https://api.github.com/users/mavasani/repos","events_url":"https://api.github.com/users/mavasani/events{/privacy}","received_events_url":"https://api.github.com/users/mavasani/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/roslyn/milestones/3","html_url":"https://github.com/dotnet/roslyn/milestones/1.1","labels_url":"https://api.github.com/repos/dotnet/roslyn/milestones/3/labels","id":937401,"number":3,"title":"1.1","description":"This is our 1.1 Milestone.\r\n\r\n<!---\r\n@huboard:{\"order\":1.5}\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":268,"closed_issues":500,"state":"open","created_at":"2015-01-15T20:48:41Z","updated_at":"2015-10-06T00:03:16Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-08-24T02:32:49Z","updated_at":"2015-10-06T00:03:16Z","closed_at":"2015-10-06T00:03:16Z","body":"I just noticed that syntax node actions for NamespaceDeclarationSyntax nodes are called multiple times if the namespace has a qualified name. Repro:\r\n\r\n```csharp\r\nusing System.Diagnostics;\r\nusing System.Collections.Immutable;\r\nusing Microsoft.CodeAnalysis;\r\nusing Microsoft.CodeAnalysis.Diagnostics;\r\nusing Microsoft.CodeAnalysis.CSharp;\r\n\r\n[DiagnosticAnalyzer(LanguageNames.CSharp)]\r\npublic class TestAnalyzer : DiagnosticAnalyzer\r\n{\r\n    public const string DiagnosticId = \"Foo\";\r\n    private const string Title = \"Foo\";\r\n    private const string MessageFormat = \"Foo\";\r\n    private const string Category = \"Foo\";\r\n    private const string Description = \"Foo\";\r\n    private const string HelpLink = \"http://foo.bar\";\r\n\r\n    private static readonly DiagnosticDescriptor Descriptor =\r\n        new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, true, Description, HelpLink);\r\n\r\n    private static readonly ImmutableArray<DiagnosticDescriptor> supportedDiagnostics =\r\n        ImmutableArray.Create(Descriptor);\r\n\r\n    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics\r\n    {\r\n        get\r\n        {\r\n            return supportedDiagnostics;\r\n        }\r\n    }\r\n\r\n    public override void Initialize(AnalysisContext context)\r\n    {\r\n        context.RegisterSyntaxNodeAction(this.HandleNamespaceDeclaration, SyntaxKind.NamespaceDeclaration);\r\n    }\r\n\r\n    private void HandleNamespaceDeclaration(SyntaxNodeAnalysisContext context)\r\n    {\r\n        Debug.WriteLine(\"Hit\");\r\n    }\r\n}\r\n```\r\nTestcode:\r\n```csharp\r\nnamespace Foo.Bar.FooBar { }\r\n```\r\n\r\nThis will print \"Hit\" 3 times. The number of calls is the same as the number of identifiers in the name of the namespace declaration.\r\nIm using roslyn 1.0."}}