{"action":"opened","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/4672","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/4672/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/4672/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/4672/events","html_url":"https://github.com/dotnet/corefx/issues/4672","id":118899355,"number":4672,"title":"DLR does not respect InternalsVisibleTo for anonymous types","user":{"login":"natemcmaster","id":2696087,"avatar_url":"https://avatars.githubusercontent.com/u/2696087?v=3","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-25T18:44:59Z","updated_at":"2015-11-25T18:44:59Z","closed_at":null,"body":"In full .NET, anonymous types are accessible via DLR across assembly boundaries. This behavior is not the same in CoreCLR. Instead, a `RuntimeBinderException` is thrown.\r\n\r\n```\r\nMicrosoft.CSharp.RuntimeBinder.RuntimeBinderException: 'object' does not contain a definition for 'xxxx'\r\n```\r\n\r\nConsider the following scenario:\r\n\r\nIn assembly ConsoleApp:\r\n```c#\r\n    public class Program\r\n    {\r\n         public static void Main()\r\n         {\r\n\t\t\tvar list = new List<object>();\r\n\t\t\tlist.AddGreeting(\"Hello world\");\r\n\t\t\tdynamic item = list[0];\r\n\t\t\tConsole.WriteLine(item.Greeting); // <--- source of error in CoreCLR\r\n         }\r\n     }\r\n```\r\n\r\nIn assembly GreetingLibrary:\r\n```c#\r\n[assembly: InternalsVisibleTo(\"ConsoleApp\")]\r\n\r\npublic static class ListExtension\r\n{\r\n    public static void AddGreeting(this List<object> source, string greeting)\r\n    {\r\n        source.Add(new { Greeting = greeting });\r\n    }\r\n}\r\n```\r\n\r\nIn .NET 4.5.1, this console application will print \"Hello world\" but in CoreCLR this application throws an exception.\r\n\r\nFull repro project: https://github.com/natemcmaster/test-dlr-bug\r\n"}}