Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Wrong property name #1052

@fabiano

Description

@fabiano

Hi,

I'm receiving the error below when I try to change a user's password using the Microsoft.AspNet.Identity.AspNetCoreCompat project.

An exception of type 'System.ArgumentException' occurred in EntityFramework.dll but was not handled in user code

Additional information: The property 'ConcurrencyToken' on type 'ApplicationUser' is not a primitive or complex property. The Property method can only be used with primitive or complex properties. Use the Reference or Collection method.

The cause is in the line https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNet.Identity.AspNetCoreCompat/IdentityDbContext.cs#L129.

There is no ConcurrencyToken property in the IdentityUser class. Changing the line to entityEntry.Property("ConcurrencyStamp").CurrentValue = Guid.NewGuid().ToString(); fixed the error.

And I had to convert the Guid to string since the type of the ConcurrencyStamp property is string.

How to replicate:

  • Create an ASP.NET MVC 4.6.1 application with Individual User Accounts
  • Reference the AspNet.Identity.CoreCompat assembly
  • Change the ApplicationUser class to inherit from the Microsoft.AspNet.Identity.CoreCompat.IdentityUser
  • Change the ApplicationDbContext class to inherit from the Microsoft.AspNet.Identity.CoreCompat.IdentityDbContext
  • Run the application
  • Create a user and try to change the password

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions