Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

DNN-30135 - Issue when loading the Persona Bar: Not Thread Safe #1126

Merged
merged 1 commit into from
Sep 29, 2019

Conversation

berkarslan-xo
Copy link
Contributor

@berkarslan-xo berkarslan-xo commented Aug 23, 2019

Fixes #1125

Summary

The problem lies in "Dnn.PersonaBar.Library.Repository.PersonaBarRepository.GetMenuItem(string identifier)" method which is called from "Evoq.PersonaBar.UI.Controllers.EvoqPersonaBarContainer.Initialize(UserControl personaBarControl)". GetMenuItem method doesn't exist in the StackTrace because JIT (Just-In-Time) Compiler does Inline Code Optimizations for release builds which basically means that some methods (especially like the ones that are only a few lines) get inlined into the previous method chain for performance reasons. Therefore, if you have a method call chain like A -> B -> C, it might become A -> B if C is inlined (you might think of it as method C's code gets copied under method B).

Using a list instance which might change state in loops (FirstOrDefault method iterates the elements one by one which behaves like a loop) will raise that error when the list gets updated while iterating. The solution is to use ToList method to copy the list's current state into another list and then use it instead for iteration. You can watch the following video I shot which demonstrates the issue: https://drive.google.com/open?id=13bneeDRu2aqicSvJ-QtV2okoPUivkHh4

@v-karbovnichy
Copy link

@dnnsoftware/tag
Can someone review this please?

@valadas valadas added this to the 10.0.0 milestone Sep 10, 2019
@valadas valadas added the bug Something isn't working label Sep 10, 2019
Copy link
Contributor

@valadas valadas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue when loading the Persona Bar: Not Thread Safe
4 participants