{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3837","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3837/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3837/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3837/events","html_url":"https://github.com/aspnet/EntityFramework/issues/3837","id":118218085,"number":3837,"title":"Generic EF.Property usage throws InvalidOperationException","user":{"login":"kyubisation","id":594745,"avatar_url":"https://avatars.githubusercontent.com/u/594745?v=3","gravatar_id":"","url":"https://api.github.com/users/kyubisation","html_url":"https://github.com/kyubisation","followers_url":"https://api.github.com/users/kyubisation/followers","following_url":"https://api.github.com/users/kyubisation/following{/other_user}","gists_url":"https://api.github.com/users/kyubisation/gists{/gist_id}","starred_url":"https://api.github.com/users/kyubisation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kyubisation/subscriptions","organizations_url":"https://api.github.com/users/kyubisation/orgs","repos_url":"https://api.github.com/users/kyubisation/repos","events_url":"https://api.github.com/users/kyubisation/events{/privacy}","received_events_url":"https://api.github.com/users/kyubisation/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"divega","id":1253414,"avatar_url":"https://avatars.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/8","html_url":"https://github.com/aspnet/EntityFramework/milestones/Investigation","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/8/labels","id":666133,"number":8,"title":"Investigation","description":"This release is used to track work items that need to be investigated to determine if they are legitimate issues and whether they should be fixed in the current release.\r\n<!--\r\n@huboard:{\"order\":-2}\r\n-->","creator":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":36,"state":"open","created_at":"2014-05-21T19:27:44Z","updated_at":"2015-12-10T00:25:54Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-11-21T20:06:17Z","updated_at":"2015-12-10T08:15:19Z","closed_at":null,"body":"I'm not quite sure whether this is a bug or just something I have to live with.\r\n\r\nTrying to use EF.Property in a generic model usage throws a InvalidOperationException (System.InvalidOperationException : The EF.Property<T> method may only be used within LINQ queries.)\r\n\r\nSee FailingGenericFilterTest in the EfTest example class.\r\n\r\n```\r\nTest Name:\tEfTest.FailingGenericFilterTest\r\nTest FullName:\tEfTest.EfTest.FailingGenericFilterTest\r\nTest Source:\t...\\EfTest\\src\\EfTest\\EfTest.cs : line 35\r\nTest Outcome:\tFailed\r\nTest Duration:\t0:00:00.523\r\n\r\nResult StackTrace:\t\r\nat Microsoft.Data.Entity.EF.Property[TProperty](Object entity, String propertyName)\r\n   at lambda_method(Closure , Model )\r\n   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\r\n   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)\r\n   at lambda_method(Closure , QueryContext )\r\n   at Microsoft.Data.Entity.Query.Internal.QueryCompiler.<>c__DisplayClass18_1`1.<CompileQuery>b__1(QueryContext qc)\r\n   at Microsoft.Data.Entity.Query.Internal.QueryCompiler.Execute[TResult](Expression query)\r\n   at Microsoft.Data.Entity.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)\r\n   at System.Linq.Queryable.Count[TSource](IQueryable`1 source)\r\n   at EfTest.EfTest.FailingGenericFilterTest() in ...\\EfTest\\src\\EfTest\\EfTest.cs:line 37\r\nResult Message:\tThe EF.Property<T> method may only be used within LINQ queries.\r\n```\r\n\r\n### Minimal repro steps\r\nUse the following project.json and class and run the xunit tests.\r\n\r\n```javascript\r\n{\r\n  \"projects\": [ \"src\" ],\r\n  \"sdk\": {\r\n    \"version\": \"1.0.0-rc1-final\"\r\n  }\r\n}\r\n```\r\n\r\n```c#\r\nusing System;\r\nusing System.ComponentModel.DataAnnotations;\r\nusing System.Linq;\r\nusing Microsoft.Data.Entity;\r\nusing Xunit;\r\n\r\nnamespace EfTest\r\n{\r\n    public delegate IQueryable<TModel> Filter<TModel>(IQueryable<TModel> queryable, string filter);\r\n\r\n    public class EfTest : IDisposable\r\n    {\r\n        private readonly TestContext _context;\r\n\r\n        public EfTest()\r\n        {\r\n            _context = new TestContext();\r\n        }\r\n\r\n        public void Dispose()\r\n        {\r\n            _context.Database.EnsureDeleted();\r\n            _context.Dispose();\r\n        }\r\n\r\n        [Fact]\r\n        public void WorkingFilterTest()\r\n        {\r\n            var filter = (Filter<Model>)\r\n                ((q, f) => q.Where(m => EF.Property<string>(m, nameof(Model.Name)) == f));\r\n            Assert.Equal(1, filter(_context.Set<Model>(), \"Test1\").Count());\r\n        }\r\n\r\n        [Fact]\r\n        public void FailingGenericFilterTest()\r\n        {\r\n            var filter = GenericFilter<Model>();\r\n            Assert.Equal(1, filter(_context.Set<Model>(), \"Test1\").Count());\r\n        }\r\n\r\n        private Filter<TModel> GenericFilter<TModel>()\r\n        {\r\n            return (q, f) => q.Where(m => EF.Property<string>(m, nameof(Model.Name)) == f);\r\n        }\r\n    }\r\n\r\n    public sealed class TestContext : DbContext\r\n    {\r\n        public TestContext() : base(new OptionBuilder().Options)\r\n        {\r\n            Add(new Model { Name = \"Test1\" });\r\n            Add(new Model { Name = \"Test2\" });\r\n            SaveChanges();\r\n        }\r\n\r\n        public DbSet<Model> Models { get; set; }\r\n\r\n        private class OptionBuilder : DbContextOptionsBuilder<TestContext>\r\n        {\r\n            public OptionBuilder()\r\n            {\r\n                this.UseInMemoryDatabase();\r\n            }\r\n        }\r\n    }\r\n\r\n    public class Model\r\n    {\r\n        [Key]\r\n        public string Name { get; set; }\r\n    }\r\n}\r\n```\r\n\r\n```javascript\r\n{\r\n  \"version\": \"1.0.0-*\",\r\n\r\n  \"dependencies\": {\r\n    \"EntityFramework.Core\": \"7.0.0-rc1-final\",\r\n    \"EntityFramework.InMemory\": \"7.0.0-rc1-final\",\r\n    \"xunit\": \"2.1.0\",\r\n    \"xunit.runner.dnx\": \"2.1.0-rc1-build204\"\r\n  },\r\n\r\n  \"commands\": {\r\n    \"test\": \"xunit.runner.dnx\"\r\n  },\r\n\r\n  \"frameworks\": {\r\n    \"dnx451\": { },\r\n    \"dnxcore50\": {\r\n      \"dependencies\": {\r\n        \"Microsoft.CSharp\": \"4.0.1-beta-23516\",\r\n        \"System.Collections\": \"4.0.11-beta-23516\",\r\n        \"System.Linq\": \"4.0.1-beta-23516\",\r\n        \"System.Runtime\": \"4.0.21-beta-23516\",\r\n        \"System.Threading\": \"4.0.11-beta-23516\"\r\n      }\r\n    }\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/163530320","html_url":"https://github.com/aspnet/EntityFramework/issues/3837#issuecomment-163530320","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3837","id":163530320,"user":{"login":"VismaCommerce","id":15815790,"avatar_url":"https://avatars.githubusercontent.com/u/15815790?v=3","gravatar_id":"","url":"https://api.github.com/users/VismaCommerce","html_url":"https://github.com/VismaCommerce","followers_url":"https://api.github.com/users/VismaCommerce/followers","following_url":"https://api.github.com/users/VismaCommerce/following{/other_user}","gists_url":"https://api.github.com/users/VismaCommerce/gists{/gist_id}","starred_url":"https://api.github.com/users/VismaCommerce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VismaCommerce/subscriptions","organizations_url":"https://api.github.com/users/VismaCommerce/orgs","repos_url":"https://api.github.com/users/VismaCommerce/repos","events_url":"https://api.github.com/users/VismaCommerce/events{/privacy}","received_events_url":"https://api.github.com/users/VismaCommerce/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T08:15:19Z","updated_at":"2015-12-10T08:15:19Z","body":"Has there been any progress regarding the investigation of this bug? We have started running into it, seemingly just by installing the 1.0.0-rc1-update1 from get.asp.net."}}