{"action":"opened","issue":{"url":"https://api.github.com/repos/schotime/NPoco/issues/337","repository_url":"https://api.github.com/repos/schotime/NPoco","labels_url":"https://api.github.com/repos/schotime/NPoco/issues/337/labels{/name}","comments_url":"https://api.github.com/repos/schotime/NPoco/issues/337/comments","events_url":"https://api.github.com/repos/schotime/NPoco/issues/337/events","html_url":"https://github.com/schotime/NPoco/issues/337","id":183833979,"number":337,"title":"Sequence contains no elements exception for class inheriting from generic list","user":{"login":"Myster","id":354777,"avatar_url":"https://avatars.githubusercontent.com/u/354777?v=3","gravatar_id":"","url":"https://api.github.com/users/Myster","html_url":"https://github.com/Myster","followers_url":"https://api.github.com/users/Myster/followers","following_url":"https://api.github.com/users/Myster/following{/other_user}","gists_url":"https://api.github.com/users/Myster/gists{/gist_id}","starred_url":"https://api.github.com/users/Myster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Myster/subscriptions","organizations_url":"https://api.github.com/users/Myster/orgs","repos_url":"https://api.github.com/users/Myster/repos","events_url":"https://api.github.com/users/Myster/events{/privacy}","received_events_url":"https://api.github.com/users/Myster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-19T00:05:09Z","updated_at":"2016-10-19T00:05:09Z","closed_at":null,"body":"This code produces an exception.\r\nI have created a class inheriting from a generic list simply so I can add the Xml annotation (which has no impact on the test) I've removed my XmlColumnSerializer as it did not affect the outcome either.\r\nIf I make Students a List<Student> it works, but if I make it a class inheriting from List<Student> it fails\r\n\r\nCode:\r\n```\r\nusing System.Collections.Generic;\r\nusing NUnit.Framework;\r\nusing System.Xml.Serialization;\r\nusing NPoco;\r\n\r\nnamespace UnitTesting\r\n{\r\n\tnamespace UnitTesting\r\n\t{\r\n\t\t[TestFixture]\r\n\t\tclass NpocoFail\r\n\t\t{\r\n\t\t\tprivate Database _database = new NPoco.Database(\"...na...\", \"System.Data.SqlClient\");\r\n\r\n\t\t\t[Test]\r\n\t\t\tpublic void Insert()\r\n\t\t\t{\r\n\t\t\t\tvar a = new AdmissionApplication() {};\r\n\t\t\t\t_database.Insert(a);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tpublic class AdmissionApplication\r\n\t\t{\r\n\t\t\t[SerializedColumn]\r\n\t\t\tpublic Students Students { get; set; } // List<Student> works\r\n\t\t}\r\n\r\n\t\t[XmlRoot(ElementName = \"Students\")]\r\n\t\tpublic class Students : List<Student>\r\n\t\t{\r\n\t\t}\r\n\r\n\t\tpublic class Student\r\n\t\t{\r\n\t\t}\r\n\t}\r\n}\r\n\r\n```\r\nException:\r\n```\r\nSystem.InvalidOperationException : Sequence contains no elements\r\n   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)\r\n   at NPoco.PocoDataBuilder.GetListType(Type memberType, Boolean isList)\r\n   at NPoco.PocoDataBuilder.<GetPocoMembers>d__28.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at NPoco.PocoDataBuilder.Init()\r\n   at NPoco.PocoDataFactory.BaseClassFalbackPocoDataBuilder(Type type)\r\n   at NPoco.PocoDataFactory.<>c__DisplayClass4_0.<TableInfoForType>b__0()\r\n   at NPoco.Cache`2.Get(TKey key, Func`1 factory)\r\n   at NPoco.PocoDataFactory.TableInfoForType(Type type)\r\n   at NPoco.Database.Insert[T](T poco)\r\n   at UnitTesting.UnitTesting.NpocoFail.Insert()\r\n```"}}
{"actor":{"display_login":"Myster"}}