{"action":"created","issue":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1189","repository_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1189/labels{/name}","comments_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1189/comments","events_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1189/events","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1189","id":164891775,"number":1189,"title":"500 (Internal Server Error) on AbpScripts/GetScripts","user":{"login":"vdurante","id":5401232,"avatar_url":"https://avatars.githubusercontent.com/u/5401232?v=3","gravatar_id":"","url":"https://api.github.com/users/vdurante","html_url":"https://github.com/vdurante","followers_url":"https://api.github.com/users/vdurante/followers","following_url":"https://api.github.com/users/vdurante/following{/other_user}","gists_url":"https://api.github.com/users/vdurante/gists{/gist_id}","starred_url":"https://api.github.com/users/vdurante/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdurante/subscriptions","organizations_url":"https://api.github.com/users/vdurante/orgs","repos_url":"https://api.github.com/users/vdurante/repos","events_url":"https://api.github.com/users/vdurante/events{/privacy}","received_events_url":"https://api.github.com/users/vdurante/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/labels/problem","name":"problem","color":"eb9460"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-07-11T17:32:39Z","updated_at":"2016-07-17T19:10:29Z","closed_at":null,"body":"Could somebody help me out? Out of a sudden I get this error when trying to get AbpScripts:\r\n\r\nERROR 2016-07-11 14:27:45,743 [56   ] Web.Mvc.Controllers.AbpScriptsController - An item with same key has already been added\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/comments/233198360","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1189#issuecomment-233198360","issue_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1189","id":233198360,"user":{"login":"hikalkan","id":1210527,"avatar_url":"https://avatars.githubusercontent.com/u/1210527?v=3","gravatar_id":"","url":"https://api.github.com/users/hikalkan","html_url":"https://github.com/hikalkan","followers_url":"https://api.github.com/users/hikalkan/followers","following_url":"https://api.github.com/users/hikalkan/following{/other_user}","gists_url":"https://api.github.com/users/hikalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/hikalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hikalkan/subscriptions","organizations_url":"https://api.github.com/users/hikalkan/orgs","repos_url":"https://api.github.com/users/hikalkan/repos","events_url":"https://api.github.com/users/hikalkan/events{/privacy}","received_events_url":"https://api.github.com/users/hikalkan/received_events","type":"User","site_admin":false},"created_at":"2016-07-17T19:10:29Z","updated_at":"2016-07-17T19:10:29Z","body":"I had also same issue. I checked executing queries and found that SQL:\r\n\r\n````SQL\r\nSELECT \r\n    CASE WHEN ( EXISTS (SELECT \r\n        1 AS [C1]\r\n        FROM [dbo].[AbpLanguages] AS [Extent1]\r\n        WHERE ((([Extent1].[TenantId] IS NULL) AND (NULL IS NULL))\r\n               OR (([Extent1].[TenantId] IS NOT NULL) AND ([Extent1].[TenantId] = NULL))\r\n               OR (1 IS NOT NULL))\r\n\r\n             AND (([Extent1].[IsDeleted] = 0) OR (1 IS NOT NULL)) \r\n             \r\n             AND ([Extent1].[TenantId] = NULL)\r\n             \r\n             AND ([Extent1].[Name] = 'en')\r\n             \r\n    )) THEN cast(1 as bit) ELSE cast(0 as bit) END AS [C1]\r\n    FROM  ( SELECT 1 AS X ) AS [SingleRowTable1]\r\n````\r\n\r\nThe important line is ``AND ([Extent1].[TenantId] = NULL)`` which should be ``AND ([Extent1].[TenantId] is NULL)`` normally.\r\n\r\nMy current solution is that: I changed AddLanguageIfNotExists in DefaultLanguagesCreator class from:\r\n\r\n````C#\r\n        private void AddLanguageIfNotExists(ApplicationLanguage language)\r\n        {\r\n            if (_context.Languages.Any(l => l.TenantId == language.TenantId && l.Name == language.Name))\r\n            {\r\n                return;\r\n            }\r\n\r\n            _context.Languages.Add(language);\r\n            _context.SaveChanges();\r\n        }\r\n````\r\n\r\nto:\r\n\r\n````C#\r\n        private void AddLanguageIfNotExists(ApplicationLanguage language)\r\n        {\r\n            if (_context.Languages.Any(l => l.TenantId == null && l.Name == language.Name))\r\n            {\r\n                return;\r\n            }\r\n\r\n            _context.Languages.Add(language);\r\n\r\n            _context.SaveChanges();\r\n        }\r\n````\r\n\r\nJust changed language.TenantId to null since we know that it's already null.\r\n\r\nBut I will try continue to investigate why the SQL wrongly generated. Maybe it's because of EntityFramework.DynamicFilters."}}
{"actor":{"display_login":"hikalkan"}}