title: Value cannot be null. Parameter name: value, CreateIdentityAsync?
body: <p>I created a ViewModel(<code>UserModel</code>) that implement <code>IUser&lt;int&gt;</code> (for customizing ASP.NET Identity 2.0)<br /></p>
  
  <pre><code>public class UserModel : IUser&lt;int&gt;
  {
      public int Id { get; set; }
  
      public string SecurityStamp { get; set; }
  
      [Display(Name = "Name")]
      public string FirstName { get; set; }
  
      [Display(Name = "Last Name")]
      public string LastName { get; set; }
  
      public string FullName { get; set; }
  
      [Display(Name = "Username")]
      public string UserName { get; set; }
  
      [DataType(DataType.Password)]
      [Display(Name = "Password")]
      public string Password { get; set; }
  
      [Display(Name = "E-Mail")]
      public string Email { get; set; }
  
      [Display(Name = "Photo")]
      public string PhotoPath { get; set; }
  
      public List&lt;Claim&gt; Claims { get; set; }
  
      [IgnoreMapping]
      public List&lt;CommentModel&gt; Comments { get; set; }
  }
  </code></pre>
  
  <p>Everything is well, but <code>GenerateUserIdentityAsync</code> method.<br />
  The following code is my <code>GenerateUserIdentityAsync</code> in UserModel:</p>
  
  <pre><code>public async Task&lt;ClaimsIdentity&gt; GenerateUserIdentityAsync(UserManager&lt;UserModel, int&gt; manager)
  {
      this.SecurityStamp = Guid.NewGuid().ToString();
      this.Claims = new List&lt;Claim&gt;();
  
      ClaimsIdentity userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);//Exception : Value cannot be null. Parameter name: value
  
      return userIdentity;
  }
  </code></pre>
  
  <p>An exception has occurred in <code>CreateIdentityAsync</code> method with the following stack trace</p>
  
  <pre><code>ArgumentNullException: Value cannot be null.
  Parameter name: value]
     System.Security.Claims.Claim..ctor(String type, String value, String valueType, String issuer, String originalIssuer, ClaimsIdentity subject, String propertyKey, String propertyValue) +10798181
     System.Security.Claims.Claim..ctor(String type, String value) +34
     Microsoft.AspNet.Identity.&lt;CreateAsync&gt;d__0.MoveNext() +1458
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
     Smartiz.UI.Models.&lt;GenerateUserIdentityAsync&gt;d__2.MoveNext() in e:\Works\Smartiz\Smartiz.UI\Models\UserModels.cs:215
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24
     Smartiz.UI.Controllers.&lt;SignInAsync&gt;d__58.MoveNext() in e:\Works\Smartiz\Smartiz.UI\Controllers\AccountController.cs:448
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
     Smartiz.UI.Controllers.&lt;ExternalLoginCallback&gt;d__3c.MoveNext() in e:\Works\Smartiz\Smartiz.UI\Controllers\AccountController.cs:315
     System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
     System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
     System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21
     System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +61
     System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass37.&lt;BeginInvokeAsynchronousActionMethod&gt;b__36(IAsyncResult asyncResult) +66
     System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49
     System.Web.Mvc.Async.AsyncInvocationWithFilters.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3d() +117
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass46.&lt;InvokeActionMethodFilterAsynchronouslyRecursive&gt;b__3f() +323
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass33.&lt;BeginInvokeActionMethodWithFilters&gt;b__32(IAsyncResult asyncResult) +44
     System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2b.&lt;BeginInvokeAction&gt;b__1c() +72
     System.Web.Mvc.Async.&lt;&gt;c__DisplayClass21.&lt;BeginInvokeAction&gt;b__1e(IAsyncResult asyncResult) +185
     System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
     System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
     System.Web.Mvc.Controller.&lt;BeginExecuteCore&gt;b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
     System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
     System.Web.Mvc.Controller.&lt;BeginExecute&gt;b__15(IAsyncResult asyncResult, Controller controller) +39
     System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
     System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
     System.Web.Mvc.MvcHandler.&lt;BeginProcessRequest&gt;b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
     System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
     System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59
     System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
     System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
     System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651188
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155
  </code></pre>
  
  <p>Could you please guide me where my wrong is ?</p>