{"action":"created","issue":{"url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions/issues/9","repository_url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions","labels_url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions/issues/9/comments","events_url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions/issues/9/events","html_url":"https://github.com/TypecastException/AspNetIdentity2GroupPermissions/issues/9","id":107229903,"number":9,"title":"Error / exception in User Admin View, unable to create Users ","user":{"login":"winecraft","id":13067681,"avatar_url":"https://avatars.githubusercontent.com/u/13067681?v=3","gravatar_id":"","url":"https://api.github.com/users/winecraft","html_url":"https://github.com/winecraft","followers_url":"https://api.github.com/users/winecraft/followers","following_url":"https://api.github.com/users/winecraft/following{/other_user}","gists_url":"https://api.github.com/users/winecraft/gists{/gist_id}","starred_url":"https://api.github.com/users/winecraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winecraft/subscriptions","organizations_url":"https://api.github.com/users/winecraft/orgs","repos_url":"https://api.github.com/users/winecraft/repos","events_url":"https://api.github.com/users/winecraft/events{/privacy}","received_events_url":"https://api.github.com/users/winecraft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-18T15:59:24Z","updated_at":"2016-06-15T00:51:23Z","closed_at":null,"body":"Hi, I wanted to report a bug, there is an exception in the user create view / action\r\n\r\nObject reference not set to an instance of an object.\r\n\r\nDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. \r\n\r\nException Details: System.NullReferenceException: Object reference not set to an instance of an object.\r\n\r\nSource Error: \r\n\r\n\r\n                Line 35:         </label>\r\n                Line 36:         <div class=\"col-md-10\">\r\n                Line 37:             @foreach (var item in (SelectList)ViewBag.GroupsList)\r\n                Line 38:             {\r\n                Line 39:           <div>\r\n\r\nSource File: g:\\AspMvcIdentity\\AspNetIdentity2GroupPermissions\\AspNetIdentity2GroupPermissions\\Views\\UsersAdmin\\Create.cshtml    Line: 37 \r\n\r\n**Stack Trace:**\r\n\r\n[NullReferenceException: Object reference not set to an instance of an object.]\r\n   ASP._Page_Views_UsersAdmin_Create_cshtml.Execute() in g:\\AspMvcIdentity\\AspNetIdentity2GroupPermissions\\AspNetIdentity2GroupPermissions\\Views\\UsersAdmin\\Create.cshtml:37\r\n   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +270\r\n   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +122\r\n   System.Web.WebPages.StartPage.RunPage() +63\r\n   System.Web.WebPages.StartPage.ExecutePageHierarchy() +100\r\n   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +131\r\n   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +695\r\n   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382\r\n   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +431\r\n   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39\r\n   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +116\r\n   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +529\r\n   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +106\r\n   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +321\r\n   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185\r\n   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42"},"comment":{"url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions/issues/comments/226059434","html_url":"https://github.com/TypecastException/AspNetIdentity2GroupPermissions/issues/9#issuecomment-226059434","issue_url":"https://api.github.com/repos/TypecastException/AspNetIdentity2GroupPermissions/issues/9","id":226059434,"user":{"login":"jamiesan","id":11778671,"avatar_url":"https://avatars.githubusercontent.com/u/11778671?v=3","gravatar_id":"","url":"https://api.github.com/users/jamiesan","html_url":"https://github.com/jamiesan","followers_url":"https://api.github.com/users/jamiesan/followers","following_url":"https://api.github.com/users/jamiesan/following{/other_user}","gists_url":"https://api.github.com/users/jamiesan/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiesan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiesan/subscriptions","organizations_url":"https://api.github.com/users/jamiesan/orgs","repos_url":"https://api.github.com/users/jamiesan/repos","events_url":"https://api.github.com/users/jamiesan/events{/privacy}","received_events_url":"https://api.github.com/users/jamiesan/received_events","type":"User","site_admin":false},"created_at":"2016-06-15T00:51:23Z","updated_at":"2016-06-15T00:51:23Z","body":"This fix for this is to change the create action a little. \r\n\r\nAdd a function called AddErrors:\r\n`        private void AddErrors(IdentityResult result)\r\n        {\r\n            foreach (var error in result.Errors)\r\n            {\r\n                ModelState.AddModelError(\"\", error);\r\n            }\r\n        }`\r\n\r\nThen in the UserAdminController Create action after the close } of the if(adminresult.Succeeded) add\r\n`AddErrors(adminresult);`\r\n\r\nAnd finally change the code at the bottom just before the return, to:\r\n\r\n`ViewBag.GroupsList =\r\n                new SelectList(this.GroupManager.Groups, \"Id\", \"Name\");`\r\n\r\n"}}
{"actor":{"display_login":"jamiesan"}}