You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.Collections.Generic.KeyNotFoundException: The given key 'PrimaryRoleId' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at AspNetCore.Pages_Identity_Users_EditModal.<ExecuteAsync>b__20_6() in D:\Github\abp\modules\identity\src\Volo.Abp.Identity.Web\Pages\Identity\Users\EditModal.cshtml:line 42
We should not use dictionary indexer (@Model.UserInfo.ExtraProperties[propertyInfo.Name]) because it throws exception if given key is not present. Instead, use @Model.UserInfo.GetProperty(propertyInfo.Name) (see the document)
(fix it in rel-4.0 branch please)
Additional notes;
Don't change asp-for="UserInfo.ExtraProperties[propertyInfo.Name]" since it provided the model expression.
I tested this feature multiple times before the stable release. In my tests, I was using the same DB and the same page. Probably, that's why I couldn't catch this before. I'm working on it.
Just try the example given in #6308
Exception message is:
Related code:
abp/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
Lines 41 to 42 in c9d4d97
We should not use dictionary indexer (
@Model.UserInfo.ExtraProperties[propertyInfo.Name]
) because it throws exception if given key is not present. Instead, use@Model.UserInfo.GetProperty(propertyInfo.Name)
(see the document)(fix it in rel-4.0 branch please)
Additional notes;
asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
since it provided the model expression.abp/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
Line 54 in c9d4d97
abp/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
Line 21 in c9d4d97
The text was updated successfully, but these errors were encountered: