{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/12297","repository_url":"https://api.github.com/repos/dotnet/roslyn","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/12297/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/12297/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/12297/events","html_url":"https://github.com/dotnet/roslyn/issues/12297","id":163059728,"number":12297,"title":"Roslyn compiler emits different code for NewExpression for anonymous type with no members","user":{"login":"bartdesmet","id":7324746,"avatar_url":"https://avatars.githubusercontent.com/u/7324746?v=3","gravatar_id":"","url":"https://api.github.com/users/bartdesmet","html_url":"https://github.com/bartdesmet","followers_url":"https://api.github.com/users/bartdesmet/followers","following_url":"https://api.github.com/users/bartdesmet/following{/other_user}","gists_url":"https://api.github.com/users/bartdesmet/gists{/gist_id}","starred_url":"https://api.github.com/users/bartdesmet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartdesmet/subscriptions","organizations_url":"https://api.github.com/users/bartdesmet/orgs","repos_url":"https://api.github.com/users/bartdesmet/repos","events_url":"https://api.github.com/users/bartdesmet/events{/privacy}","received_events_url":"https://api.github.com/users/bartdesmet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-30T00:58:17Z","updated_at":"2016-06-30T00:59:49Z","closed_at":null,"body":"Self-contained repro, comparing against C# 5 native compiler:\r\n\r\n```\r\nC:\\Temp>type a.cs\r\nusing System;\r\nusing System.Linq.Expressions;\r\n\r\nclass A\r\n{\r\n    static void Main()\r\n    {\r\n        var m = ((NewExpression)((Expression<Func<object>>)(() => new {})).Body).Members;\r\n        Console.WriteLine(m == null ? \"null\" : m.Count.ToString());\r\n    }\r\n}\r\n\r\nC:\\Temp>csc a.cs\r\nMicrosoft (R) Visual C# Compiler version 1.1.0.51204\r\nCopyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nC:\\Temp>a\r\nnull\r\n\r\nC:\\Temp>c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc a.cs\r\nMicrosoft (R) Visual C# Compiler version 4.6.1038.0\r\nfor C# 5\r\nCopyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nThis compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240\r\n\r\nC:\\Temp>a\r\n0\r\n```"},"comment":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/comments/229532429","html_url":"https://github.com/dotnet/roslyn/issues/12297#issuecomment-229532429","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/12297","id":229532429,"user":{"login":"bartdesmet","id":7324746,"avatar_url":"https://avatars.githubusercontent.com/u/7324746?v=3","gravatar_id":"","url":"https://api.github.com/users/bartdesmet","html_url":"https://github.com/bartdesmet","followers_url":"https://api.github.com/users/bartdesmet/followers","following_url":"https://api.github.com/users/bartdesmet/following{/other_user}","gists_url":"https://api.github.com/users/bartdesmet/gists{/gist_id}","starred_url":"https://api.github.com/users/bartdesmet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartdesmet/subscriptions","organizations_url":"https://api.github.com/users/bartdesmet/orgs","repos_url":"https://api.github.com/users/bartdesmet/repos","events_url":"https://api.github.com/users/bartdesmet/events{/privacy}","received_events_url":"https://api.github.com/users/bartdesmet/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T00:59:49Z","updated_at":"2016-06-30T00:59:49Z","body":"For context, we use a check against `Members` being non-null to determine whether a `NewExpression` node represents the instantiation of an anonymous type (as part of a pretty printer for expression trees as C# strings). For the corner case `new { }`, it now fails."}}
{"actor":{"display_login":"bartdesmet"}}