Race condition in InitializeMappingViewCacheFactory


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


emilcicos wrote Nov 18, 2013 at 11: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 19, 2013 at 12:51 AM

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 7:25 PM

Fixed for 6.0.2. commit 13fe904a31630b83ee8cc44f097faf65dfff8aab