Skip to content

Breaking change for IdentityRole object not documented #57427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
GorazdDim opened this issue Aug 20, 2024 · 2 comments · Fixed by #57553
Closed
1 task done

Breaking change for IdentityRole object not documented #57427

GorazdDim opened this issue Aug 20, 2024 · 2 comments · Fixed by #57553
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.

Comments

@GorazdDim
Copy link

GorazdDim commented Aug 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The IdentityRole.ConcurrencyStamp property has a changed type and default value from the 6.0.33 version to the 7.0.0 version.

In the 6.0.33 version the property is defined like: public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();

In the 7.0.0 version the property is defined like: public virtual string? ConcurrencyStamp { get; set; }

This is a breaking change and it is not documented anywhere. After a short debugging session I found the issue, but I felt i needed to report this.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Aug 20, 2024
@MackinnonBuck
Copy link
Member

It looks like this change was made accidentally. We should consider adding a default value back.

Out of curiosity, how did this break your app?

@MackinnonBuck MackinnonBuck added the bug This issue describes a behavior which is not expected - a bug. label Aug 20, 2024
@MackinnonBuck MackinnonBuck added this to the .NET 10 Planning milestone Aug 20, 2024
@GorazdDim
Copy link
Author

I implemented custom logic to compare the ConcurrencyStamp to handle concurrency errors manually, instead of relying on catching a DbUpdateConcurrencyException. Previously, the code expected a new Role to have an initial value for the ConcurrencyStamp. However, now that the initial value is null, the comparison logic incorrectly treats this as a concurrency error.

If I remove my custom logic the IdentityFramework properly handles the concurrency, which is probably why this issue wasn't noticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
2 participants