{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3923","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3923/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3923/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3923/events","html_url":"https://github.com/aspnet/EntityFramework/issues/3923","id":119442502,"number":3923,"title":"'System.AggregateException' in mscorlib.dll","user":{"login":"himadrinath","id":12247490,"avatar_url":"https://avatars.githubusercontent.com/u/12247490?v=3","gravatar_id":"","url":"https://api.github.com/users/himadrinath","html_url":"https://github.com/himadrinath","followers_url":"https://api.github.com/users/himadrinath/followers","following_url":"https://api.github.com/users/himadrinath/following{/other_user}","gists_url":"https://api.github.com/users/himadrinath/gists{/gist_id}","starred_url":"https://api.github.com/users/himadrinath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/himadrinath/subscriptions","organizations_url":"https://api.github.com/users/himadrinath/orgs","repos_url":"https://api.github.com/users/himadrinath/repos","events_url":"https://api.github.com/users/himadrinath/events{/privacy}","received_events_url":"https://api.github.com/users/himadrinath/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-30T08:36:18Z","updated_at":"2015-12-16T15:26:49Z","closed_at":null,"body":"running mvc 6 in 1.0.0-rc1-final also have a Class Library added as reference in this project to maintain sqlserver data model with identity. after creating relationship between models and updating database every thing works fine. and then when i created a mvc form which has 3 entities one parent entity (Advertisement) and other two (Contact) and (CellPhone) both of them has  one-to-one relationship with entity (Advertisement)\r\n\r\n<b>builder.Entity&#60;Advertisement&#62;()\r\n          .HasOne(u => u.Contact)\r\n          .WithOne(t => t.Advertisement)\r\n          .HasForeignKey&#60;Contact&#62;(b=> b.pubID).IsRequired()\r\n          .OnDelete(Microsoft.Data.Entity.Metadata.DeleteBehavior.Cascade);</b>\r\n\r\n<b>builder.Entity&#60;Advertisement&#62;()\r\n            .HasOne(u => u.CellPhone)\r\n            .WithOne(u => u.Advertisement)\r\n            .HasForeignKey&#60;CellPhone&#62;(b => b.pubID).IsRequired()\r\n            .OnDelete(Microsoft.Data.Entity.Metadata.DeleteBehavior.Cascade);</b>\r\n\r\nwhen i submitted a create form with this 3 entities its working fine. but when i try to edit with it. i getting an error.\r\n\r\n<b>A database operation failed while processing the request.\r\n\r\nAggregateException: One or more errors occurred. \r\nAggregateException: One or more errors occurred. \r\nAggregateException: One or more errors occurred. \r\nAggregateException: One or more errors occurred. \r\nAggregateException: One or more errors occurred. \r\nAggregateException: One or more errors occurred. \r\nAggregateException: One or more errors occurred. \r\nInvalidCastException: Specified cast is not valid. \r\nThere are pending model changes for ApplicationDbContext\r\nScaffold a new migration for these changes and apply them to the database from the command line:\r\n\r\n&#62; dnx ef migrations add [migration name] \r\n&#62; dnx ef database update\r\n</b>\r\n\r\ni run a trace with Sql Server Profiler. The query executing perfectly ok and getting the result as i expected but some how i getting this error. i don't under the reason behind it.\r\n\r\nin my edit controller i run this command to get the data.\r\n\r\n<b>Advertisement advertisement = await _context.Advertisements.Include(s=&#62; s.CellPhone).Include(s=&#62; s.Contact).SingleAsync(m =&#62; m.ID == id);</b>\r\n\r\nand here is my Sql Server Profiler trace file\r\n\r\n[AggregateExceptionTxt.txt](https://github.com/aspnet/EntityFramework/files/47070/AggregateExceptionTxt.txt)\r\n\r\nwhen i  Include the contact entity in this query i getting this error if i only Include the CellPhone entity its working fine"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/165141379","html_url":"https://github.com/aspnet/EntityFramework/issues/3923#issuecomment-165141379","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3923","id":165141379,"user":{"login":"himadrinath","id":12247490,"avatar_url":"https://avatars.githubusercontent.com/u/12247490?v=3","gravatar_id":"","url":"https://api.github.com/users/himadrinath","html_url":"https://github.com/himadrinath","followers_url":"https://api.github.com/users/himadrinath/followers","following_url":"https://api.github.com/users/himadrinath/following{/other_user}","gists_url":"https://api.github.com/users/himadrinath/gists{/gist_id}","starred_url":"https://api.github.com/users/himadrinath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/himadrinath/subscriptions","organizations_url":"https://api.github.com/users/himadrinath/orgs","repos_url":"https://api.github.com/users/himadrinath/repos","events_url":"https://api.github.com/users/himadrinath/events{/privacy}","received_events_url":"https://api.github.com/users/himadrinath/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T15:26:49Z","updated_at":"2015-12-16T15:26:49Z","body":"@rowanmiller did u find something?"}}