Race condition in InitializeMappingViewCacheFactory


The race condition occurs in the Func passed to _contextTypesWithViewCacheInitialized.GetOrAdd, when setting itemCollection.MappingViewCacheFactory.
Closed Nov 22, 2013 at 10:45 PM by Mugdhak
Verified FIxed


emilcicos wrote Nov 18, 2013 at 10:46 PM

On second look, even if the MappingViewCacheFactory setter is called multiple times with different instances of DefaultDbMappingViewCacheFactory as values, the exception should not be thrown because the instances are equal (Equals is overriden) as long as they refer the same DbMappingViewCacheTypeAttribute instance.

emilcicos wrote Nov 18, 2013 at 11:51 PM

It turns out that Assembly.GetCustomAttributes returns new instances on each call, while the implementation of DefaultDbMappingViewCacheFactory assumes they are unique.

emilcicos wrote Nov 19, 2013 at 6:25 PM

Fixed for 6.0.2. commit 13fe904a31630b83ee8cc44f097faf65dfff8aab