{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/25663","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/25663/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/25663/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/25663/events","html_url":"https://github.com/dotnet/corefx/issues/25663","id":278784130,"number":25663,"title":"Soundness feedback requested: Increasing cache success in S.L.Expressions","user":{"login":"JonHanna","id":1253369,"avatar_url":"https://avatars3.githubusercontent.com/u/1253369?v=4","gravatar_id":"","url":"https://api.github.com/users/JonHanna","html_url":"https://github.com/JonHanna","followers_url":"https://api.github.com/users/JonHanna/followers","following_url":"https://api.github.com/users/JonHanna/following{/other_user}","gists_url":"https://api.github.com/users/JonHanna/gists{/gist_id}","starred_url":"https://api.github.com/users/JonHanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonHanna/subscriptions","organizations_url":"https://api.github.com/users/JonHanna/orgs","repos_url":"https://api.github.com/users/JonHanna/repos","events_url":"https://api.github.com/users/JonHanna/events{/privacy}","received_events_url":"https://api.github.com/users/JonHanna/received_events","type":"User","site_admin":false},"labels":[{"id":253912726,"url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Linq.Expressions","name":"area-System.Linq.Expressions","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-12-03T14:44:16Z","updated_at":"2017-12-04T04:07:21Z","closed_at":"2017-12-04T03:09:35Z","author_association":"COLLABORATOR","body":"Expressions contains a `CanCache(Type)` method that reports on the safety of caching a delegate or information about a method based on whether the type is a mscrolib type that (if generic) has only mscorlib type parameters.\r\n\r\nThe netfx version allows not just mscorlib types to be considered safe, but also those in System.Core where the cache lives. While there aren't as many types in corefx's S.L.Expressions as there are in netfx's S.Core, this basic principle seems sound to me.\r\n\r\nIt also seems worth doing, tracking hits and misses (of the outer calls only, ignoring its recursive calls on generic parameters except as they affect the final result) has the tests for Microsoft.CSharp go from 0.05% hits to 54.40% and the tests for System.Dynamic.Runtime go from 0.27% to 41.87%. (S.L.Expressions itself goes from 49.59% to 54.34%, and if anything I was expecting it to be an unfair comparison in explicitly using Expressions types more than other tests would, but it it also does a lot of permutations on the primitive types that would have a high hit rate). That would seem to be enough to suggest that dynamic is attempting to cache with so low a success rate as to maybe not be worth trying, but with the change to include Expressions' types it becomes much more useful.\r\n\r\nAnd it **seems** safe to me, as surely if the types in Expressions were collectible then collecting would also make the static cache collected.\r\n\r\nQuestion 1: Am I wrong in this? Could a type in Expressions be collectible without the `TypeUtils` type becoming collectible (unreachable at least, even if not yet collected) and making the static cache collectible? Because if I am wrong, then this idea isn't safe.\r\n\r\nQuestion 2: If I'm correct in this, and caching uses of these types would be safe, would it also be safe to consider types in assemblies referenced by Expressions (transitively) safe to cache?\r\n\r\nQuestion 3: Iff the answer to the first question is \"safe\" and to the second is \"not safe\", would the assemblies of types that are base types or implemented interfaces of safe types, also be safe (probably too much of a burden to check that to pay off anyway, but figuring out an efficient way to check on this is a separate investigation)."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/348855855","html_url":"https://github.com/dotnet/corefx/issues/25663#issuecomment-348855855","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/25663","id":348855855,"user":{"login":"jkotas","id":6668460,"avatar_url":"https://avatars2.githubusercontent.com/u/6668460?v=4","gravatar_id":"","url":"https://api.github.com/users/jkotas","html_url":"https://github.com/jkotas","followers_url":"https://api.github.com/users/jkotas/followers","following_url":"https://api.github.com/users/jkotas/following{/other_user}","gists_url":"https://api.github.com/users/jkotas/gists{/gist_id}","starred_url":"https://api.github.com/users/jkotas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkotas/subscriptions","organizations_url":"https://api.github.com/users/jkotas/orgs","repos_url":"https://api.github.com/users/jkotas/repos","events_url":"https://api.github.com/users/jkotas/events{/privacy}","received_events_url":"https://api.github.com/users/jkotas/received_events","type":"User","site_admin":false},"created_at":"2017-12-04T04:07:21Z","updated_at":"2017-12-04T04:07:21Z","author_association":"MEMBER","body":"Note that System.Linq.Expressions has direct access to CoreLib. It means that you can use CoreLib APIs that are not exposed in public contracts (yet). It is preferable to do it that way instead of private reflection."}}
{"actor":{"display_login":"jkotas"}}