aspnet / Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.96k stars 868 forks source link

[bug].net core 2.1,Identity will throw exception while implement IdentityUser. But .net core 2.0 is Ok. #1872

Closed blowdart closed 6 years ago

blowdart commented 6 years ago

From @Caizhenyu on July 7, 2018 11:58

I am using asp net core Identity Framework on core 2.1, and I implement my ApplicationUser : IdentityUser .Then there will throw Exception like the screenshot . But I found that, the same code is Ok on core 2.0, or I just user IdentityUser not my own ApplicationUser is also ok while services.AddIdentity<TUser, TRole>.

Is it's a core 2.1 bug? tim 20180707194836

Copied from original issue: aspnet/Security#1804

brockallen commented 6 years ago

Sounds like a DI config bug. Normally AddIdentity<CustomUser> would add the UserManager<CustomUser>

Caizhenyu commented 6 years ago

@brockallen ,so ,i think it's maybe a bug

HaoK commented 6 years ago

What's startup look like?

Caizhenyu commented 6 years ago

@HaoK, nothing special. ApplicationUser : IdentityUser

ConfigureServices: services.AddIdentity<ApplicationUser, IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders();

Configure: app.UseAuthentication();

you can rebuild it 3min.

tstivers1990 commented 6 years ago

@Caizhenyu Any chance you could create a repo that reproduces this issue? I'm not experiencing this myself, and my code looks very similar to what's shown here.

HaoK commented 6 years ago

Closing due to lack of repro