Skip to content
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

Lookup extra properties is not working #6543

Closed
hikalkan opened this issue Dec 8, 2020 · 1 comment
Closed

Lookup extra properties is not working #6543

hikalkan opened this issue Dec 8, 2020 · 1 comment

Comments

@hikalkan
Copy link
Member

hikalkan commented Dec 8, 2020

Just try the example given in #6308

Exception message is:

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

Related code:

autocomplete-selected-item-name="@Model.UserInfo.ExtraProperties[propertyInfo.Name+"_Text"]"
autocomplete-selected-item-value="@Model.UserInfo.ExtraProperties[propertyInfo.Name]"

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;

@ilkayilknur
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants